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
consecutive failures of the script. After that, 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 successes will add
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 failures.


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