java – Eureka服务器的问题

前端之家收集整理的这篇文章主要介绍了java – Eureka服务器的问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我有一个本地eureka服务器和一个客户端

尤里卡:

server:
 port: 1111

eureka:
 instance:
   prefer-ip-address: true
 client:
   registerWithEureka: false
   fetchRegistry: false
   serviceUrl:
      defaultZone: http://127.0.0.1:1111/eureka/
 server:
   waitTimeInMsWhenSyncEmpty: 0    

客户:

eureka:
  instance:
    prefer-ip-address: true
  client:
    serviceUrl:
    defaultZone: http://127.0.0.1:1111/eureka/

我有两个问题:

1)Eu​​reka服务器抛出日志:

NullPointerException:
at com.netflix.eureka.resources.StatusResource.isReplicaAvailable

2)客户端与Eureka连接,但过了一段时间我在他的日志中看到了下一个:

RedirectingEurekaHttpClient : Request execution error
javax.ws.rs.WebApplicationException: null at com.netflix.discovery.provider.DiscoveryJerseyProvider.readFrom(DiscoveryJerseyProvider.java:110)

RetryableEurekaHttpClient : Request execution failure
DiscoveryClient : DiscoveryClient_MW/192.168.0.100:client:8080 – was unable to send heartbeat!

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

在日志Eureka我看到:

InstanceRegistry : DS: Registry: lease doesn’t exist,registering resource: CLIENT – 192.168.0.100:client:8080
InstanceResource : Not Found (Renew): CLIENT – 192.168.0.100:client:8080

在Eureka Web控制台中,客户端具有UP状态,但也有一个很大的铭文:

RENEWALS ARE LESSER THAN THE THRESHOLD. THE SELF PRESERVATION MODE IS
TURNED OFF.THIS MAY NOT PROTECT INSTANCE EXPIRY IN CASE OF
NETWORK/OTHER PROBLEM

虽然连接正常,但我可以通过Eureka链接到我的客户端.

你能解释它的含义以及如何摆脱它吗?

最佳答案
serviceUrl:
defaultZone: http://127.0.0.1:1111/eureka/

在客户端设置YML时,你应该在“defaultZone”之前添加空格,如下所示:

serviceUrl:
  defaultZone: http://127.0.0.1:1111/eureka/

否则defaultZone与serviceUrl处于同一级别.
谢谢

原文链接:https://www.f2er.com/spring/432806.html

猜你在找的Spring相关文章