尤里卡续订门槛&续订(最后一分钟) [英] Eureka Renews threshold & Renews (last min)

查看:126
本文介绍了尤里卡续订门槛&续订(最后一分钟)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Eureka服务器A和两个B(Client3)和C(Client4)客户端实例

I have one Eureka Server A and two client instances of B(Client3) and C(Client4)

我从Eureka Server获得了以下日志:

I got logs from Eureka Server, which are as follows :

2018-01-25 12:56:27.828  INFO 7145 --- [nio-8765-exec-2] c.n.e.registry.AbstractInstanceRegistry  : Registered instance CLIENT3/client3:bb488bb73fd313321e393915f746bfe5 with status UP (replication=false)
2018-01-25 12:56:28.417  INFO 7145 --- [nio-8765-exec-3] c.n.e.registry.AbstractInstanceRegistry  : Registered instance CLIENT3/client3:bb488bb73fd313321e393915f746bfe5 with status UP (replication=true)
2018-01-25 12:56:33.028  INFO 7145 --- [nio-8765-exec-3] c.n.e.registry.AbstractInstanceRegistry  : Registered instance CLIENT4/client4:9fcbf4ed26162ee12c4c4b85774c39b1 with status UP (replication=false)
2018-01-25 12:56:33.542  INFO 7145 --- [nio-8765-exec-8] c.n.e.registry.AbstractInstanceRegistry  : Registered instance CLIENT4/client4:9fcbf4ed26162ee12c4c4b85774c39b1 with status UP (replication=true)

a)它们是什么意思?我的意思是每个客户出现两次

b)更新阈值:5,更新(最后一个分钟):8,为什么更新的最后一个分钟是8,应该是4?由于只有两个客户,因此每位客户每分钟2次跳动

c)当我启动3rd Service D(CLient5)时,续订阈值为6而不是7,为什么?

d)Eureka Peers如何相互传递信息增量信息以及何时传递信息?例如,当前有两个尤里卡服务器(对等)和两个客户端(每个实例1个).现在,当一个新客户注册时,它将向两个或两个同行发送节拍吗?在其中一个中,另一个对等方怎么知道?

推荐答案

a)这意味着Eureka正在向自己复制心跳.这很可能是由于配置错误.如果您查看Eureka的仪表板,您的主机可能位于unavailable-replicas列表中.要解决此问题,Eureka实例名称必须与defaultZone中使用的主机名相同.因此,对于您的独立Eureka服务器,配置应类似于

a) This means that Eureka is replicating heartbeats to itself. This is most probably due to misconfiguration. If you take a look at Eureka's dashboard you probably have your host on the list of unavailable-replicas. To fix this, Eureka instance name needs to be the same as hostname used in defaultZone. So, for your standalone Eureka server the config should look like

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8080/eureka/
  instance:
    hostname: localhost

eureka.instance.hostnameeureka.client.serviceUrl.defaultZone中的主机名匹配至关重要.配置完毕后,unavailable-replicas应该消失.

It is crucial for eureka.instance.hostname to match with the hostname in eureka.client.serviceUrl.defaultZone. Once you configure this, the unavailable-replicas should disappear.

b)一旦解决了a)的问题,该问题将得到解决,并且应该会收到4次续订.

b) Once you fix a) this problem should be fixed and you should see 4 renewals.

c)要在此处

数学原理如下:如果有两个客户端注册到一个 尤里卡(Eureka)实例,每个实例每30秒发送一次心跳,该实例 一分钟内应该会收到4次心跳.春天增加了一个较低的最小值 的1到那个(可通过 eureka.instance.registry.expectedNumberOfRenewsPerMin),因此 实例希望每分钟收到5个心跳.然后是 乘以0.85(可通过 eureka.server.renewalPercentThreshold)并四舍五入到下一个 整数,使我们再次回到5.如果有的话 超过15分钟内尤里卡(Eureka)收到的5次心跳(可通过 eureka.server.renewalThresholdUpdateIntervalMs), 自我保存模式并停止已注册的过期 实例.

The math works like this: If there are two clients registered to a Eureka instance, each one sending a heartbeat every 30s, the instance should receive 4 heartbeats in a minute. Spring adds a lower minimum of 1 to that (configurable by eureka.instance.registry.expectedNumberOfRenewsPerMin), so the instance expects to receive 5 heartbeats every minute. This is then multiplied by 0.85 (configurable by eureka.server.renewalPercentThreshold) and rounded to the next integer, which brings us back to 5 again. If anytime there are less than 5 heartbeats received by Eureka in 15min (configurable by eureka.server.renewalThresholdUpdateIntervalMs), it goes into self-preservation mode and stops expiring already registered instances.

因此,在您的情况下,有两个实例:(2 * 2 +1)* 0.85 = 4.25,四舍五入为5.对于三个实例(2 * 3 +1)* 0.85 = 5.95四舍五入为6.

So, in your case for two instances: (2 * 2 + 1) * 0.85 = 4.25, rounded to 5. For three instances (2 * 3 + 1) * 0.85 = 5.95 rounded to 6.

d) Eureka客户端仅将心跳发送到一个服务器实例.该实例将这些心跳传递给其他心跳,使它们保持更新.如果您查看Eureka服务器日志,则可以找到类似这样的日志

d) Eureka clients send heartbeats to only one server instance. That instance pass those heartbeats to the other ones keeping them updated. If you check Eureka server logs, you can find logs like this

InstanceRegistry: renew SERVICEA serverId localhost:serviceA:12345, isReplication {}true

如果isReplication为true,则表示续订是从对等服务器节点发送的.如果为假,则表示实例本身已收到续订.

If isReplication is true, this means that the renewal is sent from the peer server node. If it is false, that means the instance itself received a renewal.

这篇关于尤里卡续订门槛&续订(最后一分钟)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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