I'm using Keepalived to manage two Redis instances in a master/slave configuration. I'm experiencing a situation where, if Keepalived is terminated on the Master box (the one with the higher priority), the Backup server takes over as the master. When Keepalived is restarted on the higher priority box, however, the Backup server immediately cedes Master status over to the higher priority box, which effectively flushes the Redis cache.
I tried adding the nopreempt directive to my keepalived.conf, but this behavior is still happening.
The below is the keepalived.conf from the Backup (lower priority) server.
global_defs{
router_id redis_server_2
}
vrrp_script chk_redis {
script "killall -0 redis-server"
interval 5
}
vrrp_instance VI_1{
interface eth0
virtual_router_id 100
priority 200
advert_int 1
state BACKUP
nopreempt
track_script {
chk_redis
}
virtual_ipaddress {
10.19.105.229
}
notify_master "/usr/bin/sudo /var/lib/redis/redis.sh -m"
notify_backup "/usr/bin/sudo /var/lib/redis/redis.sh -s"
notify_fault "/usr/bin/sudo /var/lib/redis/redis.sh -k"