#spring-boot #netflix-eureka
#весенняя загрузка #netflix-eureka
Вопрос:
У меня периодически появляются журналы, в которых сообщается, что клиент Eureka не может отправить свое сердцебиение на сервер Eureka. Регистрация работает нормально, и она способна отправлять 95% своих сердцебиений. Я вижу только спорадические сбои в вызовах в экземплярах, которые не выполняются на той же виртуальной машине, что и eureka.
Мы обновили Spring boot до версии 2.1.2 и использовали спецификацию с Greenwich.ВЫПУСК (до того, как мы использовали Finchley.РЕЛИЗ). С Finchley.В ВЫПУСКЕ мы видели эти журналы очень редко, если вообще видели.
Конфигурация клиента в application.yml
eureka:
instance:
prefer-ip-address: true
ip-address: ${HOSTNAME}
client:
serviceUrl:
defaultZone: http://my-eureka:8761/eureka/
Если я вывожу зависимости gradle, я вижу, что http-клиент был обновлен до последней версии исправления ошибок: 4.5.7
--- com.sun.jersey.contribs:jersey-apache-client4:1.19.1
| | | --- org.apache.httpcomponents:httpclient:4.1.1 -> 4.5.7
| | | | --- org.apache.httpcomponents:httpcore:4.4.11
| | | | --- commons-codec:commons-codec:1.11
| | | --- com.sun.jersey:jersey-client:1.19.1 (*)
| | --- org.apache.httpcomponents:httpclient:4.5.3 -> 4.5.7 (*)
Журналы, которые я вижу:
05:26:20.527 [AsyncResolver-bootstrap-executor-0] INFO c.n.d.s.r.aws.ConfigClusterResolver - Resolving eureka endpoints via configuration
05:31:20.528 [AsyncResolver-bootstrap-executor-0] INFO c.n.d.s.r.aws.ConfigClusterResolver - Resolving eureka endpoints via configuration
05:36:20.528 [AsyncResolver-bootstrap-executor-0] INFO c.n.d.s.r.aws.ConfigClusterResolver - Resolving eureka endpoints via configuration
05:41:20.529 [AsyncResolver-bootstrap-executor-0] INFO c.n.d.s.r.aws.ConfigClusterResolver - Resolving eureka endpoints via configuration
05:41:33.949 [DiscoveryClient-CacheRefreshExecutor-0] INFO o.a.h.impl.client.DefaultHttpClient - I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {}->http://my-eureka:8761: The target server failed to respond
05:41:33.949 [DiscoveryClient-CacheRefreshExecutor-0] INFO o.a.h.impl.client.DefaultHttpClient - Retrying request to {}->http://my-eureka:8761
05:42:03.953 [DiscoveryClient-HeartbeatExecutor-0] ERROR c.n.d.s.t.d.RedirectingEurekaHttpClient - Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://my-eureka:8761/eureka/}
com.sun.jersey.api.client.ClientHandlerException: org.apache.http.NoHttpResponseException: my-eureka:8761 failed to respond
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187)
at com.sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.java:123)
at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27)
at com.sun.jersey.api.client.Client.handle(Client.java:652)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.put(WebResource.java:529)
at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.sendHeartBeat(AbstractJerseyEurekaHttpClient.java:102)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$3.execute(EurekaHttpClientDecorator.java:92)
at com.netflix.discovery.shared.transport.decorator.MetricsCollectingEurekaHttpClient.execute(MetricsCollectingEurekaHttpClient.java:73)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.sendHeartBeat(EurekaHttpClientDecorator.java:89)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$3.execute(EurekaHttpClientDecorator.java:92)
at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.execute(RedirectingEurekaHttpClient.java:89)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.sendHeartBeat(EurekaHttpClientDecorator.java:89)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$3.execute(EurekaHttpClientDecorator.java:92)
at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:120)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.sendHeartBeat(EurekaHttpClientDecorator.java:89)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$3.execute(EurekaHttpClientDecorator.java:92)
at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.sendHeartBeat(EurekaHttpClientDecorator.java:89)
at com.netflix.discovery.DiscoveryClient.renew(DiscoveryClient.java:846)
at com.netflix.discovery.DiscoveryClient$HeartbeatThread.run(DiscoveryClient.java:1405)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.http.NoHttpResponseException: my-eureka:8761 failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:294)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:257)
at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:230)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:679)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:481)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:173)
... 26 common frames omitted
05:42:03.954 [DiscoveryClient-HeartbeatExecutor-0] WARN c.n.d.s.t.d.RetryableEurekaHttpClient - Request execution failed with message: org.apache.http.NoHttpResponseException: my-eureka:8761 failed to respond
05:42:03.956 [DiscoveryClient-HeartbeatExecutor-0] INFO c.n.d.s.t.d.RetryableEurekaHttpClient - Request execution succeeded on retry #1
05:46:20.529 [AsyncResolver-bootstrap-executor-0] INFO c.n.d.s.r.aws.ConfigClusterResolver - Resolving eureka endpoints via configuration
Комментарии:
1. Это происходит и у меня. Вы нашли что-нибудь об исправлении этого?
Ответ №1:
Похоже, проблема с клиентом jersey, попробуйте исключить зависимости от jersey.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>2.1.2.RELEASE</version>
<exclusions>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-apache-client4</artifactId>
</exclusion>
</exclusions>
</dependency>