Coincidentally, I've been trying to get 'nopreempt' to work as well,
but can't seem to get it working. The config is the same on both
servers except for the priority is changed to 100 on the other server.
I'm testing on CentOS 5.5 32 bit with keepalived 1.1.20.
vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 2
weight 2
}
vrrp_instance VI_1 {
state BACKUP
nopreempt
interface eth0
virtual_router_id 20
priority 101
virtual_ipaddress {
10.79.8.20
}
track_script {
chk_haproxy
}
}
To test the failover, I kill the haproxy instance on the current
master. The logs indicate that the check script fails, but no
failover ever occurs. If the keepalived process itself is killed, the
failover occurs as expected.
Log from MASTER after killing haproxy:
Sep 17 00:21:47 cl-t099-281cl Keepalived: Starting Keepalived v1.1.20
(09/15,2010)
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Registering Kernel
netlink reflector
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Registering Kernel
netlink command channel
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Registering gratutious
ARP shared channel
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Opening file
'/etc/keepalived/keepalived.conf'.
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Configuration is using
: 34460 Bytes
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: ------< Global
definitions >------
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Router ID = abc
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Smtp server = 127.0.0.1
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Smtp server connection
timeout = 30
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Email notification
from = ***@abc
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: ------< VRRP Topology >------
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: VRRP Instance = VI_1
Sep 17 00:21:47 cl-t099-281cl Keepalived: Starting VRRP child process, pid=15191
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Want State = BACKUP
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Runing on device = eth0
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Virtual Router ID = 20
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Priority = 101
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Advert interval = 1sec
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Preempt disabled
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Tracked scripts = 1
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: chk_haproxy weight 2
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Virtual IP = 1
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: 10.79.8.20/32 dev
eth0 scope global
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: ------< VRRP Scripts >------
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: VRRP Script = chk_haproxy
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Command = killall -0 haproxy
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Interval = 2 sec
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Weight = 2
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Rise = 1
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Full = 1
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Status = INIT
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: Using LinkWatch kernel
netlink reflector...
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: VRRP_Instance(VI_1)
Entering BACKUP STATE
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp: VRRP sockpool:
[ifindex(2), proto(112), fd(9,10)]
Sep 17 00:21:47 cl-t099-281cl Keepalived_vrrp:
VRRP_Script(chk_haproxy) succeeded
Sep 17 00:21:51 cl-t099-281cl Keepalived_vrrp: VRRP_Instance(VI_1)
Transition to MASTER STATE
Sep 17 00:21:52 cl-t099-281cl Keepalived_vrrp: VRRP_Instance(VI_1)
Entering MASTER STATE
Sep 17 00:21:52 cl-t099-281cl Keepalived_vrrp: VRRP_Instance(VI_1)
setting protocol VIPs.
Sep 17 00:21:52 cl-t099-281cl Keepalived_vrrp: VRRP_Instance(VI_1)
Sending gratuitous ARPs on eth0 for 10.79.8.20
Sep 17 00:21:57 cl-t099-281cl Keepalived_vrrp: VRRP_Instance(VI_1)
Sending gratuitous ARPs on eth0 for 10.79.8.20
Sep 17 00:22:07 cl-t099-281cl Keepalived_vrrp: VRRP_Script(chk_haproxy) failed
Log from BACKUP after killing haproxy on master:
Sep 17 00:21:52 cl-t099-291cl Keepalived_vrrp: Using LinkWatch kernel
netlink reflector...
Sep 17 00:21:52 cl-t099-291cl Keepalived_vrrp: VRRP_Instance(VI_1)
Entering BACKUP STATE
Sep 17 00:21:52 cl-t099-291cl Keepalived_vrrp: VRRP sockpool:
[ifindex(2), proto(112), fd(9,10)]
Sep 17 00:21:52 cl-t099-291cl Keepalived_vrrp:
VRRP_Script(chk_haproxy) succeeded