1. weight 大于0

如果腳本監(jiān)測失敗,優(yōu)先級不變,如果成功,優(yōu)先級增加,如果后續(xù)監(jiān)測失敗,則優(yōu)先級在增加的基礎(chǔ)上回退,這個weight不會持續(xù)增加或減小,只會存在兩個值

2. weight 小于0

如果腳本監(jiān)測失敗,優(yōu)先級降低,如果成功,優(yōu)先級不變,這個weight不會持續(xù)增加或減小,只會存在兩個值


另外,keepalived啟動時,不論rise和fall的設(shè)置的是多少,首次監(jiān)測腳本,都會根據(jù)上面的原則調(diào)整,后續(xù)的調(diào)整則要只有在進(jìn)入fall和rise到達(dá)之后才會調(diào)整



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