Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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.

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"
share|improve this question

1 Answer 1

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
    
serverfault.com/questions/44122/… –  quanta Oct 10 '12 at 8:50

Your Answer

 
discard

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.