Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

        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
        track_script {

        virtual_ipaddress {

        notify_master "/usr/bin/sudo /var/lib/redis/ -m"

        notify_backup "/usr/bin/sudo /var/lib/redis/ -s"

        notify_fault "/usr/bin/sudo /var/lib/redis/ -k"
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Okay, I solved it after thinking about it for a few minutes.

Under VRRP_instance V1 on the higher priority box, I had the following:

    state MASTER

Now, nopreempt wasn't being honored because the higher priority box was starting as master. The lower priority box saw a master with a higher priority and switched to slave mode. By changing that line to

    state BACKUP

the higher priority box starts as the slave, sees a master with a higher priority, and remains slave. Done and done.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.