将异常积分千分尺用于弹性搜索应用

时间:2019-08-19 11:55:18

标签: spring-boot elasticsearch prometheus spring-micrometer

我有一个Spring-Boot应用程序,该应用程序调用弹性搜索集群。我想添加普适监视。我只添加  依存关系  运行应用程序后,我立即获得java.util.concurrent.TimeoutException

     <!-- Spring boot actuator to expose metrics endpoint -->
     <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
     </dependency>
     <!-- Micormeter core dependecy  -->
     <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-core</artifactId>
     </dependency>
     <!-- Micrometer Prometheus registry  -->
     <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-prometheus</artifactId>
     </dependency>

我的错误日志如下

org.elasticsearch.ElasticsearchTimeoutException: java.util.concurrent.TimeoutException: Timeout waiting for task.
    at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:72) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:54) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:44) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.springframework.boot.actuate.elasticsearch.ElasticsearchHealthIndicator.doHealthCheck(ElasticsearchHealthIndicator.java:80) ~[spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:84) [spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:98) [spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.actuate.health.HealthEndpoint.health(HealthEndpoint.java:50) [spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:246) [spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
    at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:76) [spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:61) [spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.actuate.endpoint.jmx.EndpointMBean.invoke(EndpointMBean.java:126) [spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at org.springframework.boot.actuate.endpoint.jmx.EndpointMBean.invoke(EndpointMBean.java:99) [spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809) [?:?]
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [?:?]
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466) [?:?]
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307) [?:?]
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399) [?:?]
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827) [?:?]
    at jdk.internal.reflect.GeneratedMethodAccessor53.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) [?:?]
    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:562) [?:?]
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) [?:?]
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) [?:?]
    at java.security.AccessController.doPrivileged(Native Method) [?:?]
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.util.concurrent.TimeoutException: Timeout waiting for task.
    at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:235) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:69) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:70) ~[elasticsearch-6.4.3.jar:6.4.3]
    ... 37 more

2 个答案:

答案 0 :(得分:0)

stacktrace似乎指示ElasticsearchHealthIndicator.doHealthCheck任务Timeout waiting for task.。如果无法建立连接,通常会发生这种情况。您提到了弹性搜索服务正在外部服务器上运行。您能否检查程序是否可以访问服务器上的Elasticsearch端口?

默认情况下,Elasticsearch仅限于localhost,因为如果没有外部程序可以访问它。

答案 1 :(得分:0)

连接弹性搜索后,在本地运行的问题得到解决。正如我猜想的,原因是连接不良。与千分尺无关