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
发布评论