描述:
在SpirngCloud项目中,使用了一段时间后,服务仍然可以正常启动,业务正常,可能由于频繁重启日志出错如下:
现象:
2021-10-09 09:35:11.436 WARN [nfoReplicator-0] c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.SocketTimeoutException: Read timed out
2021-10-09 09:35:11.436 WARN [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_BIGDATA-LABELFACTORY-REST/10.159.59.53:7280 - registration failed Retry limit reached; giving up on completing the request
com.netflix.discovery.shared.transport.TransportException: Retry limit reached; giving up on completing the request
at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:139)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator 1. e x e c u t e ( E u r e k a H t t p C l i e n t D e c o r a t o r . j a v a : 59 ) a t c o m . n e t f l i x . d i s c o v e r y . s h a r e d . t r a n s p o r t . d e c o r a t o r . S e s s i o n e d E u r e k a H t t p C l i e n t . e x e c u t e ( S e s s i o n e d E u r e k a H t t p C l i e n t . j a v a : 77 ) a t c o m . n e t f l i x . d i s c o v e r y . s h a r e d . t r a n s p o r t . d e c o r a t o r . E u r e k a H t t p C l i e n t D e c o r a t o r . r e g i s t e r ( E u r e k a H t t p C l i e n t D e c o r a t o r . j a v a : 56 ) a t c o m . n e t f l i x . d i s c o v e r y . D i s c o v e r y C l i e n t . r e g i s t e r ( D i s c o v e r y C l i e n t . j a v a : 829 ) a t c o m . n e t f l i x . d i s c o v e r y . I n s t a n c e I n f o R e p l i c a t o r . r u n ( I n s t a n c e I n f o R e p l i c a t o r . j a v a : 121 ) a t j a v a . u t i l . c o n c u r r e n t . E x e c u t o r s 1.execute(EurekaHttpClientDecorator.java:59) at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56) at com.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:829) at com.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:121) at java.util.concurrent.Executors 1.execute(EurekaHttpClientDecorator.java:59)atcom.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)atcom.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)atcom.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:829)atcom.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:121)atjava.util.concurrent.ExecutorsRunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access 201 ( S c h e d u l e d T h r e a d P o o l E x e c u t o r . j a v a : 180 ) a t j a v a . u t i l . c o n c u r r e n t . S c h e d u l e d T h r e a d P o o l E x e c u t o r 201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor 201(ScheduledThreadPoolExecutor.java:180)atjava.util.concurrent.ScheduledThreadPoolExecutorScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
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)
2021-10-09 09:35:11.436 WARN [nfoReplicator-0] c.n.discovery.InstanceInfoReplicator : There was a problem with the instance info replicator
com.netflix.discovery.shared.transport.TransportException: Retry limit reached; giving up on completing the request

解决方法
在配置文件application.properties中加上
#是否向注册中心注册自己,缺省:true
eureka.client.register-with-eureka=false
#是否从Eureka获取注册信息,注册中心职责是维护服务实例,false:不检索服务。
eureka.client.fetch-registry=false

参考链接:https://www.cnblogs.com/chihirotan/p/11568185.html
参考链接:https://daijiguo.blog.csdn.net/article/details/84245769?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-10.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-10.no_search_link

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐