<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
spring.data.elasticsearch.cluster-name=es
spring.data.elasticsearch.cluster-nodes=10.17.12.158:9300
spring.data.elasticsearch.repositories.enabled=true
集群方式
failed to load elasticsearch nodes :
org.elasticsearch.client.transport.NoNodeAvailableException:
None of the configured nodes are available:
[{#transport#-1}{HiXBU0PNRV6j7QDw9ZcyNw}{10.17.12.158}{10.17.12.158:9300}, {#transport#-2}{fA87OUrESfCfixlGYDQF3Q}{10.17.12.159}{10.17.12.159:9300}, {#transport#-3}{f7qINyogSoqUf6pv4Gt3Mw}{10.17.12.160}{10.17.12.160:9300}]
单节点
failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{av8BbMdQSe-Ys7hGal7LDw}{10.17.12.158}{10.17.12.158:9300}]
初步判定,应该是spring-boot-starter-data-elasticsearch与Elasticsearch 7.x版本不兼容造成的。
通过测试发现,将Elasticsearch降级到6.x版本,即可解决。