我们有两个同行的eureka设置。 这两个对等设备在两个不同的虚拟机上运行,即testvm01.mydomain.com和testvm02.mydomain.com。
这两个对等体使用以下配置。
对等方1:
eureka:
instance:
hostname: testvm01.mydomain.com
leaseRenewalIntervalInSeconds: 3
client:
registerWithEureka: true
serviceUrl:
defaultZone: http://testvm02.mydomain.com:8761/eureka
dashboard:
enabled: true
对等体2:
eureka:
instance:
hostname: testvm02.mydomain.com
leaseRenewalIntervalInSeconds: 3
client:
registerWithEureka: true
serviceUrl:
defaultZone: http://testvm01.mydomain.com:8761/eureka
server:
waitTimeInMsWhenSyncEmpty: 0
dashboard:
enabled: true
如果我现在关闭这两个尤里卡同行,那么另一个会产生大量的日志消息,如下所示:
2015-05-28 12:07:18.675 ERROR 15871 --- [artbeat-process] c.netflix.eureka.cluster.PeerEurekaNode : PeerEurekaNode: http://testvm01.mydomain.com:8761/eurekaapps/: MAIL-SERVICE/testvm02.mydomain.com:mail-service:9880:Heartbeat
com.sun.jersey.api.client.ClientHandlerException: java.net.SocketTimeoutException: Read timed out
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:184)
at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:28)
at com.sun.jersey.api.client.Client.handle(Client.java:648)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.put(WebResource.java:527)
at com.netflix.eureka.cluster.PeerEurekaNode.sendHeartBeat(PeerEurekaNode.java:510)
at com.netflix.eureka.cluster.PeerEurekaNode.access$400(PeerEurekaNode.java:72)
at com.netflix.eureka.cluster.PeerEurekaNode$3.execute(PeerEurekaNode.java:275)
at com.netflix.eureka.cluster.PeerEurekaNode$6.executeSingle(PeerEurekaNode.java:992)
at com.netflix.eureka.cluster.PeerEurekaNode$6.process(PeerEurekaNode.java:844)
at com.netflix.logging.messaging.MessageBatcher$ProcessMessages.run(MessageBatcher.java:410)
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.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:160)
at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:84)
at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:273)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:283)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:251)
at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:223)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:685)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:487)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:115)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:170)
... 14 common frames omitted
这些消息可在不到3小时内生成大约5 GB的日志消息。
我的配置有问题吗?这是春天云还是尤里卡的错误? 我该怎么做才能正确处理这个问题?现在我只关闭了com.netflix.eureka.cluster.PeerEurekaNode的日志记录,但这对于以后的生产环境肯定是不可接受的。
版本:
Spring-Boot:1.2.3.RELEASE
Spring-Cloud-Starter-Parent-Bom:1.0.1.RELEASE