尤里卡从不注销服务 [英] Eureka never unregisters a service

查看:70
本文介绍了尤里卡从不注销服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前遇到一个问题,尤里卡没有注销注册的服务.我直接从git hub提取了Eureka服务器示例,仅做了一个更改,即eureka.enableSelfPreservation = false.我的application.yml看起来像这样:

I'm currently facing an issue where Eureka does not unregister a registered service. I've pulled the Eureka server example straight from git hub and made only one change, eureka.enableSelfPreservation = false. My application.yml looks like this:

server:
  port: 8761
eureka:
  enableSelfPreservation: false
  client:
    registerWithEureka: false
fetchRegistry: false
  server:
    waitTimeInMsWhenSyncEmpty: 0

我已阅读到,如果85%的已注册服务在15分钟内停止传递心跳,Eureka会认为该问题与网络有关,并且不会注销未响应的服务.就我而言,我仅运行一项服务,因此我禁用了自我保留模式.我突然终止了该进程,Eureka放弃了在似乎无限期的时间内注册该服务.

I've read that if 85% of the registered services stop delivering heartbeats within 15 minutes, Eureka assumes the issue is network related and does not de-register the services that are not responding. In my case I have only one service running, so I disabled self-preservation mode. I am abruptly killing the process and Eureka leaves the service registered for what seems like an indefinite amount of time.

我客户的application.yml看起来像这样:

My client's application.yml looks like this:

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 3
  client:
    healthcheck:
      enabled: true
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
  appInfo:
    replicate:
      interval: 3
    initial:
      replicate:
        time: 3
spring:
  rabbitmq:
    addresses: ${vcap.services.${PREFIX:}rabbitmq.credentials.uri:amqp://${RABBITMQ_HOST:localhost}:${RABBITMQ_PORT:5672}}

我的目标是创建一个演示,其中Eureka可以快速检测到该服务不再运行,并且启动的另一个服务可以快速注册自己.

My goal is to create a demo where Eureka quickly detects the service is no longer running and another service that is started can quickly register itself.

到目前为止,一旦eureka客户端启动,它将在3秒钟内注册.当服务突然终止时,它永远不会注销.我取消服务后,Eureka仪表板显示为:

As of now, once the eureka client is started, it registers in 3 seconds. It just never un-registers when the service is abruptly terminated. After I kill the service, the Eureka dashboard reads:

紧急!如果不是,EUREKA可能会不正确地提出索赔要求.续订不只是阈值,因此不再只是为了安全起见就可以终止实例.

EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.

如何防止这种行为?

推荐答案

我意识到自我保存模式从未真正被禁用.原来实际的属性是

I realized that self preservation mode was never actually being disabled. It turns out the actual property is

eureka.server.enableSelfPreservation=false

(请参见 DefaultEurekaServerConfig 代码),我在任何地方都没有找到它的文档.这解决了我的问题.

(See DefaultEurekaServerConfig Code), which I haven't found documented anywhere. This resolved my issue.

这篇关于尤里卡从不注销服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆