springboot整合Elasticsearch6.3.2踩坑

首先确保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,在依赖中加上

扫描二维码关注公众号,回复: 9262024 查看本文章
<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 即可

发布了22 篇原创文章 · 获赞 12 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/benyuanone/article/details/103765130