Actuator Elasticsearch healthcheck error

1. Relevant environment

<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. Problem

spring-boot-start-actuator on when the project elasticsearch health checks when introduced error:java.lang.NoClassDefFoundError: org/elasticsearch/client/Request

 

Troubleshooting:

 

This package org.elasticsearch.client to go in and found that there is no Request class

This package is introduced come together when introduced into spring-boot-starter-data-elasticsearch of

 

Trying to change the version of the package and found that only the latest version 2.2.0 contains org.elasticsearch.client.Request class

But when we changed to version 2.2.0, when there will be new mistakes, directly reported:  java.net.ConnectException: Connection refused,

elasticsearch Rom.

Change actuator version also can not solve the problem.

3. Solution

method one
spring.data.elasticsearch.cluster-name=docker-cluster-50
spring.data.elasticsearch.cluster-nodes=ip:9300
spring.elasticsearch.rest.uris=["http://ip:9200"]
Method Two
management.health.elasticsearch.enabled=false

 

Guess you like

Origin www.cnblogs.com/dreamfly2016/p/11760845.html