获取将千分尺集成到弹性搜索应用程序的异常

Posted

技术标签:

【中文标题】获取将千分尺集成到弹性搜索应用程序的异常【英文标题】:get exception integrating micrometer to elastic-search application 【发布时间】:2019-12-24 15:26:41 【问题描述】:

我有一个调用弹性搜索集群的 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

【问题讨论】:

您能描述一下您的环境吗?好像无法访问elasticsearch/prometheus主机 我是本地主机中的应用程序,Prometheus 在本地主机上运行。在另一台服务器中进行弹性搜索 【参考方案1】:

堆栈跟踪似乎表明ElasticsearchHealthIndicator.doHealthCheck 任务Timeout waiting for task.。如果无法建立连接,这通常会发生。您提到弹性搜索服务在外部服务器上运行。你能检查一下程序是否可以访问服务器上的 Elasticsearch 端口吗?

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

【讨论】:

在本地运行弹性搜索之后。它的工作原理谢谢你 您能否将此解决方案标记为答案,以便其他人可以找到它? @DamithaDayananda【参考方案2】:

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

【讨论】:

以上是关于获取将千分尺集成到弹性搜索应用程序的异常的主要内容,如果未能解决你的问题,请参考以下文章

搜索线程池的弹性搜索队列大小

无法使用弹性接收器连接器将数据从融合平台发送到 Elasticsearch。异常:错误处理程序中超出了容差

如何将弹性搜索索引或日志从一个弹性搜索服务器复制到另一台?

有没有办法使用千分尺在telegraf中获取kafka流和骆驼指标

Elasticsearch Spring boot 集成测试

弹性搜索 - 如何解释此异常