spring boot整合ElasticSearch啓動報錯None of the configured nodes are available

1. application.properties 中的集羣名和 es安裝目錄下的/config/elasticsearch.yml 中的集羣名配置要一致。

例如 elasticsearch.yml 中

# ---------------------------------- Cluster ---------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application

那麼application.properties 中應該是

spring.data.elasticsearch.cluster-name=my-application

2. application.properties中集羣節點的配置,不是elasticsearch.yml中的network.host:http.port,也就是默認的9200,這是http端口號,java項目中使用的是tcp端口,如果不配置默認是9300

spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300

​ 要自行配置tcp端口的話,就是在elasticsearch.yml中增加如下配置,記得和spring.data.elasticsearch.cluster-nodes對應。

transport.tcp.port: 9301
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章