首先確保Elasticsearch6.3.2安裝成功
1.出現NoNodeAvailableException[None of the configured nodes are available
解決:elasticsearch6.3.2的配置文件修改如下:
network.host: 192.168.3.222 #改成自己局域網ip
transport.tcp.port: 9300 #springboot連接使用的端口
transport.tcp.compress: true
http.port: 9100
2.not part of the cluster,節點不屬於集羣問題,(本人使用的是單節點)
在瀏覽器輸入ip+端口
上圖中框出來的就是在springboot配置文件中cluster-name的值
3.NoSuchFieldError: LUCENE_6_0_0
本人的springboot版本是2.1.7RELEASE,在依賴中加上
<dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-core</artifactId> <version>7.4.0</version> </dependency>
4.Elasticsearch health check failed
解決:增加spring.elasticsearch.rest
的配置,
spring:
data:
elasticsearch:
cluster-name: docker-cluster
cluster-nodes: 192.168.3.68:9300
elasticsearch:
rest:
uris: ["http://192.168.3.68:9100"]
配置好 uris
即可