Cannot execute request on any known server或DiscoveryClient_UNKNOWN/DESKTOP-MQ8D0C9:8761
报错信息如下:
2018-08-31 11:45:33.619 WARN 1068 --- [freshExecutor-0] c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused: connect
2018-08-31 11:45:33.619 ERROR 1068 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_UNKNOWN/admin-PC:6900 - was unable to refresh its cache! status = Cannot execute request on any known server
2018-08-31 11:45:03.687 WARN 1068 --- [nfoReplicator-0] c.n.discovery.InstanceInfoReplicator : There was a problem with the instance info replicator
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
错误原因:
1、Eureka服务注册中心也会将自己作为客户端来尝试注册它自己,所以我们需要禁用它的客户端注册行为即可。
2、如果你写的是client端,注册server服务,也有可能是你注册的服务没有启动造成的。
解决方案如下:
第一种错误原因,解决如下:
在配置文件中添加如下配置:
eureka.client.register-with-eureka=false eureka.client.fetch-registry=false
第二种错误原因,直接启用server服务即可。