版本问题解决NoNodeAvailableException[None of the configured nodes are available

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

spring-data-elasticsearch和elasticsearch的版本要匹配

首先进入依赖视图Diagrams -> show dependencies,按Ctrl+F搜索spring-data-elasticsearch

我的版本是3.2.5.RELEASE,找到对应elasticsearch版本为6.5.0,而我原来的版本为5.6.12

于是乎下载对应版本的elasticsearch镜像,并运行

docker pull elasticsearch:6.5.0
docker run --name elasticsearch -d -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -e "discovery.type=single-node" elastics
earch:6.5.0

运行成功后,在网页上输入虚拟机IP和端口号9200

http://x.x.x.x:9200

跳出如下界面表示运行成功

在application.properties中添加如下配置

spring.elasticsearch.jest.uris=http://x.x.x.x:9200

spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=x.x.x.x:9300

猜你喜欢

转载自www.cnblogs.com/taozi1115402474/p/12402612.html