1. weight 大于0

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

2. weight 小于0

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


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