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??