zoukankan      html  css  js  c++  java
  • Actuator Elasticsearch healthcheck error

    1. 相关环境

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
      <version>2.1.4.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
      <version>2.1.4.RELEASE</version>
    </dependency>

    2. 问题

    当引入了spring-boot-start-actuator对项目中elasticsearch进行健康检查时报错:java.lang.NoClassDefFoundError: org/elasticsearch/client/Request

    问题排查:

    到这个包org.elasticsearch.client中去找,发现确实没有Request类

    这个包是在引入spring-boot-starter-data-elasticsearch的时候一起引入进来的

    试图改变包的版本,发现只有最新版本2.2.0中包含了org.elasticsearch.client.Request类

    但是当我们把版本改到2.2.0的时候又会有新的错误,直接报: java.net.ConnectException: Connection refused

    elasticsearch连不上了。

    改变actuator的版本同样不能解决问题。

    3. 解决办法

    方法一
    spring.data.elasticsearch.cluster-name=docker-cluster-50
    spring.data.elasticsearch.cluster-nodes=ip:9300
    spring.elasticsearch.rest.uris=["http://ip:9200"]
    方法二
    management.health.elasticsearch.enabled=false
    The miracle is this--the more we share, the more we have
  • 相关阅读:
    c++作业2 9.22
    c++作业1 9.22
    c++练习题2
    c++练习题1
    10.10作业3
    10.10作业2
    10.10作业 1
    9.22作业5
    9.22作业4
    9.22zuo
  • 原文地址:https://www.cnblogs.com/dreamfly2016/p/11760845.html
Copyright © 2011-2022 走看看