19

I am working with Elastic Search 5.5.0 on Spring boot 1.5.8.RELEASE using the Java Transport Client library.

The Elastic Search was deployed with docker in a container. It works well. The queries from my java application works well too.

The problem is that the Elasticsearch Health check failed almost every time when Spring boot started from my local machine as the following exception says. I didn't call any health check explicitly in my application.

How can I remove the health check every time on start up or are there any way of passing the health check?

Thanks.

20180201 09:04:12.499 [restartedMain] INFO c.k.a.Application - Log info On 
20180201 09:04:12.499 [restartedMain] WARN c.k.a.Application - Log warn On 
20180201 09:04:12.499 [restartedMain] ERROR c.k.a.Application - Log error On 
20180201 09:04:15.628 [RMI TCP Connection(9)-10.10.20.187] WARN o.s.b.a.h.ElasticsearchHealthIndicator - Health check failed 
org.elasticsearch.ElasticsearchTimeoutException: java.util.concurrent.TimeoutException: Timeout waiting for task.
    at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:71)
    at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:58)
    at org.springframework.boot.actuate.health.ElasticsearchHealthIndicator.doHealthCheck(ElasticsearchHealthIndicator.java:52)
    at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:43)
    at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:68)
    at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:85)
    at org.springframework.boot.actuate.endpoint.HealthEndpoint.invoke(HealthEndpoint.java:35)
    at org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean.getData(DataEndpointMBean.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1252)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1246)
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1085)
    at org.springframework.jmx.export.SpringModelMBean.invoke(SpringModelMBean.java:90)
    at javax.management.modelmbean.RequiredModelMBean.getAttribute(RequiredModelMBean.java:1562)
    at org.springframework.jmx.export.SpringModelMBean.getAttribute(SpringModelMBean.java:109)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1445)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
    at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:639)
    at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.TimeoutException: Timeout waiting for task.
    at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:232)
    at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:67)
    at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:69)
    ... 47 common frames omitted
RobinZheng
  • 301
  • 1
  • 2
  • 9

4 Answers4

32

You can disable the Elasticsearch health check by adding the following line to your application.xml file

management.health.elasticsearch.enabled: false
Ashraf Sarhan
  • 1,507
  • 16
  • 21
9

When I went deep into the same issue happening in my sprint boot app too, I found that elasticsearch health check use org.elasticsearch.client.RestClient but I was using org.elasticsearch.client.RestHighLevelClient and had created Bean for the same.

In case you want to keep the recurring elasticsearch's healthcheck,
Create a Bean for RestClient using the right host and port.

Or add following entry in app config yml/xml to remove healthcheck itself:

management.health.elasticsearch.enabled: false
Durgesh Suthar
  • 2,914
  • 4
  • 19
  • 22
3

disable the health indicator auto configuration

@SpringBootApplication(exclude = {        
    ElasticSearchRestHealthIndicatorAutoConfiguration.class
})
public class YourApplication
Liam
  • 565
  • 5
  • 10
0

Disable elastic search health check. Mention this property in your yml/xml file

management.health.elasticsearch.enabled=false

CodingBee
  • 1,011
  • 11
  • 8