当前在eureka上注册的server/client实例(Instances currently registered with Eureka),ip显示,在server/client端配置application.yml配置以下:git
eureka: client: service-url: defaultZone: http://xxx/eureka instance: prefer-ip-address: true instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}} #eureka显示ip
Eureka 在设计时,认为分布式环境的网络是不可靠的,可能会出现网络缘由致使 EurekaServer 没有收到实例的心跳而这却并不能说明实例就宕了,因此 EurekaServer 缺省会打开保护模式,它主要是网络分区场景下的一种保护一旦进入保护模式,EurekaServer 将会尝试保护其服务注册表中的信息,再也不删除里面的数据(即不会注销任何微服务)相关介绍,详见: github
https://github.com/Netflix/eureka/wiki/Understanding-Eureka-Peer-to-Peer-Communicationspring
咱们能够经过配置文件的方式关闭自我保护模式。网络
server端:app
eureka: server: enable-self-preservation: false #关闭eureka的自我保护 eviction-interval-timer-in-ms: 4000 #清理间隔时间,单位为毫秒(默认值60 * 1000)
client端:分布式
eureka: instance: lease-renewal-interval-in-seconds: 5 # 租期更新时间隔时间(缺省为30s) lease-expiration-duration-in-seconds: 15 # 租期到期时间(缺省为90s) client: healthcheck: enabled: true # 开启健康检查(依赖spring-boot-starter-actuator)