keepalived的weight

Posted liuanhf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了keepalived的weight相关的知识,希望对你有一定的参考价值。

1. weight 大于0

如果脚本监测失败,优先级不变,如果成功,优先级增加,如果后续监测失败,则优先级在增加的基础上回退,这个weight不会持续增加或减小,只会存在两个值

2. weight 小于0

如果脚本监测失败,优先级降低,如果成功,优先级不变,这个weight不会持续增加或减小,只会存在两个值


另外,keepalived启动时,不论rise和fall的设置的是多少,首次监测脚本,都会根据上面的原则调整,后续的调整则要只有在进入fall和rise到达之后才会调整



       The  default  weight equals 0, which means that any VRRP instance moni-
toring the script will transition to the fault state after <fall>
consecutive failures of the script. After that, <rise> consecu-
tive successes will cause VRRP instances to leave the fault state,
unless they are also in the fault state due to other scripts or inter-
faces that they are tracking.

A positive weight means that <rise> successes will add
<weight> to the priority of all VRRP instances which monitor it.
On the opposite, a negative weight will be subtracted from the initial
priority in case of <fall> failures.


参考:​​https://www.keepalived.org/manpage.html​

以上是关于keepalived的weight的主要内容,如果未能解决你的问题,请参考以下文章

构建高可用集群Keepalived+Haproxy

keepalived之vrrp_script详解

keepalived weight正负值问题(实现主服务器nginx故障后迅速切换到备服务器)

C++ 代码片段执行

Keepalived 角色选举

高可用 - 08 Keepalived集群中Master和Backup角色选举策略