整合elasticsearch遇到的问题

目录

报错信息

问题分析

总结


报错信息

NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{SBV8frpTTIiwbU2dgCOFbA}{127.0.0.1}{127.0.0.1:9300}]

这个报错的大致意思是elasticsearch的节点不可用

问题分析

首先确保我们的elasticsearch是启动的,如果在启动的状态下,我们先查看spring boot的配置文件

spring.data.elasticsearch.cluster-name=my-application
spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300

咋看看elasticsearch的配置文件是否跟我们在SpringBoot上配置的一致

---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: D:\work\data\elasticsearch-6.4.3\data
#
# Path to log files:
#
path.logs: D:\work\data\elasticsearch-6.4.3\logs
#

发现文件配置都是没有问题的。

可能是其他原因,elasticsearch版本与Spring Boot的版本不兼容

修改spring Bootd的版本

<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.5.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

elasticsearch的版本 6.4.3

重新测试,运行成功

总结

出现这个报错,有可能有两个原因

  • 首先 查看自己在SpringBoot配置的elasticsearch内容是否与elasticsearch.yml一致
  • 如果配置没有出现问题,那很有可能是版本不兼容,尝试修改elasticsearcgh 或 springboot版本。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值