NoNodeAvailableException[None of the configured nodes are available

编程入门 行业动态 更新时间:2024-10-28 03:17:48

NoNodeAvailableException[None of the <a href=https://www.elefans.com/category/jswz/34/1759100.html style=configured nodes are available"/>

NoNodeAvailableException[None of the configured nodes are available

由于前段时间使用SpringBoot连接ES6.5使用的不亦乐乎,如今发现7.x以后的kibana中Dev Tools对中文支持相比较于6.x时代好了几个时代,果断将ES环境切到7.x,但问题也随之而来了。

此处记录一下使用springboot的工具spring-boot-starter-data-elasticsearch操作ES时遇到的坑,
正常创建索引时控制台报错log:

NoNodeAvailableException[None of the configured nodes are available....

根据这个log,我们首先排序有可能是我们的application.yml配置配错了,正确配置如下:

spring:data:elasticsearch:cluster-name: my-applicationcluster-nodes: 192.168.126.131:9300network:host: 0.0.0.0

ES服务器报错log:

org.elasticsearch.action.NoShardAvailableActionException: No shard available for [get [.kibana][_doc][config:7.0.1]: routing [null]]

在重复之前失败的请求之后log更新为:

java.lang.IllegalStateException: Received handshake message from unsupported version: [5.0.0] minimal compatible version is: [6.7.0]....

根据抛出的这个异常找到了原因,是之前用的springBoot版本已经不支持 elasticsearch 7.x(我的是elasticsearch 7.0.1, SpringBoot 版本 是2.0.6的)

注意⚠️SpringBoot是2.2.0.RELEASE才兼容elasticsearch 7.x

所以只需对pom文件SpringBoot依赖的父版本修改成2.2.0及以上的即可。

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

再启动测试,发现索引终于创建成功了。

更多推荐

NoNodeAvailableException[None of the configured nodes are available

本文发布于:2024-03-12 00:05:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1730241.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NoNodeAvailableException   configured   nodes

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!