Keepalived设置master故障恢复后不重新抢回VIP
(1)、master配置
! Configuration File for keepalived
global_defs {
router_id lb01
}
vrrp_script check_ng {
script "/etc/keepalived/check_keepalived.sh"
interval 2
weight -5
fall 3
rise 2
}
vrrp_instance VI_1 {
state BACKUP # 主上也设置为备
interface ens33
virtual_router_id 51
priority 150
advert_int 1
nopreempt # 设置为不抢夺VIP
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.169.200
}
track_script {
check_ng
}
}
(2)、slave配置
! Configuration File for keepalived
global_defs {
router_id lb02
}
vrrp_script check_ng {
script "/etc/keepalived/check_keepalived.sh"
interval 2
weight -5
fall 3
rise 2
}
vrrp_instance VI_1 {
state BACKUP
interface ens33
virtual_router_id 51
priority 149
advert_int 1
nopreempt
authentication {
auth_type PASS
auth_pass 1111
virtual_ipaddress {
192.168.169.200
}
track_script {
check_ng
}
}