解决springboot连接elastic报错:NoNodeAvailableException[None of the configured nodes are available

现象如下:

 原因有以下几种:

1. elastic在配置文件中cluster-name写错了。

注意:elastic集群名不能随便写,通过 elaticIP://9200可以查看服务端的集群名是什么:

2. elastic在配置文件中的端口写错了:因为是transport tcp模式, 端口必须是9300,不是9200 

3. elastic客户端版本跟服务端版本不匹配。

如下图:

报错:java.lang.IllegalStateException: Received message from unsupported version: [5.6.0] minimal compatible version is: [2.0.0]

 而我的Spring Data Elasticsearch 3.2.3 版本兼容 服务端Elasticsearch 6.x 系列,不能兼容服务端已经安装的2.4.6版本。

 所以linux服务端docker安装并运行elastic 6.8.12版本即可

docker run -dti --name=elastic-6.8.12   --network=host --restart=always elasticsearch:6.8.12

 然后springboot启动报错消失:

 elastic服务端启动日志正常:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值