I have a eureka server running in standalone mode (non-clustered mode) on port 9010 and a eureka client running on port 9020.
When the eureka client starts it registers with the eureka server. After registration is successful with eureka, I see the below exception stack trace in eureka-service.
[[2m2018-04-28 00:33:39.377 INFO 12996 --- [nio-9010-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-04-28 00:33:39.378 INFO 12996 --- [nio-9010-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-04-28 00:33:39.423 INFO 12996 --- [nio-9010-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 45 ms
2018-04-28 00:33:39.727 INFO 12996 --- [nio-9010-exec-4] c.n.e.registry.AbstractInstanceRegistry : Registered instance EUREKA-CLIENT/demo-machine:eureka-client:9020 with status UP (replication=false)
2018-04-28 00:33:40.716 ERROR 12996 --- [get_localhost-2] c.n.e.cluster.ReplicationTaskProcessor : Network level connection to peer localhost; retrying after delay
com.sun.jersey.api.client.ClientHandlerException: org.apache.http.conn.ConnectTimeoutException: Connect to localhost:8761 timed out
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
at com.netflix.eureka.cluster.DynamicGZIPContentEncodingFilter.handle(DynamicGZIPContentEncodingFilter.java:48) ~[eureka-core-1.7.2.jar:1.7.2]
at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.7.2.jar:1.7.2]
at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar:1.19.1]
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) ~[jersey-client-1.19.1.jar:1.19.1]
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) ~[jersey-client-1.19.1.jar:1.19.1]
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570) ~[jersey-client-1.19.1.jar:1.19.1]
at com.netflix.eureka.transport.JerseyReplicationClient.submitBatchUpdates(JerseyReplicationClient.java:116) ~[eureka-core-1.7.2.jar:1.7.2]
at com.netflix.eureka.cluster.ReplicationTaskProcessor.process(ReplicationTaskProcessor.java:71) ~[eureka-core-1.7.2.jar:1.7.2]
at com.netflix.eureka.util.batcher.TaskExecutors$BatchWorkerRunnable.run(TaskExecutors.java:187) [eureka-core-1.7.2.jar:1.7.2]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to localhost:8761 timed out
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123) ~[httpclient-4.5.5.jar:4.5.5]
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) ~[httpclient-4.5.5.jar:4.5.5]
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144) ~[httpclient-4.5.5.jar:4.5.5]
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:134) ~[httpclient-4.5.5.jar:4.5.5]
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610) ~[httpclient-4.5.5.jar:4.5.5]
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445) ~[httpclient-4.5.5.jar:4.5.5]
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835) ~[httpclient-4.5.5.jar:4.5.5]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118) ~[httpclient-4.5.5.jar:4.5.5]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) ~[httpclient-4.5.5.jar:4.5.5]
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:173) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
... 10 common frames omitted
](url)
After every few seconds, the stack trace is repeatedly seen in the eureka-service logs.
I have the configuration in eureka-service as below.
application.yml
server:
port: 9010
eureka:
client:
register-with-eureka: false
fetch-registry: false
In eureka-client, I have application configuration as below.
server:
port: 9020
eureka:
client:
serviceUrl:
defaultZone: http://localhost:9010/eureka/
I am using Spring Boot 1.5.12 and Spring Cloud Edgware.SR3
Is this due to some configuration or a bug with latest version of boot/cloud.
I have the code I used to reproduce this issue in the below github repo, https://github.com/gsamartian/eureka-demos
I also have added the error I obtained in the log file over there.
Can you please help me on thIs.
The eureka server is trying to send its data to a peer and it can't connect to the default location.
If you don't want peering you can try and set eureka.server.maxThreadsForPeerReplication=0
@gsamartian Did solution provided by @spencergibb fix your problem? Because I too have the same problem. And @spencergibb's solution did not fix my problem.
@SunilDSK did you find any solution..? I am also facing same issue..
Could you try to change your configuration like below
eureka:
client:
registerWithEureka: false
fetchRegistry: false
service-url:
defaultZone: http://localhost:8888/eureka
If you specify server.port: 8888 in eureka server. So your eureka is running on 8888 port. But you didn't specify any service-url for eureka. So I think that your eureka server is trying to replicate to localhost:8761 because it's default and you didn't specify service-url for eureka.
By adding this in eureka server fixed my issue
eureka.client.service-url.defaultZone=https://www.ns-dev01.myproject.com/eureka/
Most helpful comment
If you don't want peering you can try and set
eureka.server.maxThreadsForPeerReplication=0