I may not be understanding how this is supposed to work, but I can't figure out why the BACKUP system with this basic vrrp_instance is transitioning to master right away and never seems to honor the priority.
Why wouldn't the virtual IP address drop off the backup system when both are healthy and online?
It looks like both systems are broadcasting the vrrp advertisement. From tcpdump
on the backup system:
betaproxyslc01.fakecorp.com > vrrp.mcast.net: vrrp betaproxyslc01.fakecorp.com > vrrp.mcast.net: VRRPv2, Advertisement, vrid 51, prio 150, authtype simple, intvl 1s, length 20, >addrs: virtual-app.fakecorp.com auth "password" 15:52:24.541637 IP (tos 0xc0, ttl 255, id 1611, offset 0, flags [none], proto VRRP (112), length 40)
betaproxyslc02.fakecorp.com > vrrp.mcast.net: vrrp betaproxyslc02.fakecorp.com > vrrp.mcast.net: VRRPv2, Advertisement, vrid 51, prio 100, authtype simple, intvl 1s, length 20, >addrs: virtual-app.fakecorp.com auth "password" 15:52:25.410073 IP (tos 0xc0, ttl 255, id 1779, offset 0, flags [none], proto VRRP (112), length 40)
but the virtual IP address is showing up on both hosts with an ip addr
command.
Here's the config:
global_defs {
notification_email {
me@fakecorp.com
}
notification_email_from keepalived@betaproxyslc01.fakecorp.com
smtp_server mysmtpserver.fakecorp.com
smtp_connect_timeout 30
router_id BETAPROXYSLC01
}
vrrp_script chk_haproxy{
script "killall -0 haproxy"
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 150
advert_int 1
notify /usr/local/bin/notify.sh
authentication {
auth_type PASS
auth_pass keep0ut!
}
virtual_ipaddress {
10.10.0.40
}
track_script{
chk_haproxy
}
}
On the BACKUP server the router_id is different, state is BACKUP, and priority is 100. The other settings are the same.
This is on CentOS 7 install, with Keepalived v1.2.10 (06/10,2014), a Hyper-V guest VM, with a 3.10.0-123.8.1.el7.x86_64 kernel.