Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running replicated Redis that includes a master and just one slave. My goal is to implement a replication (using Redis sentinels) in which the slave becomes master when the master goes down, but additionally the old master is promoted back when it recovers.

The initial setup is easy. I'm using one sentinel on the same server as master and two sentinels on the server with slave. With quorum of two, the two sentinels on slave server promote the slave to master when the master is unavailable. When the old master comes back, it reconnects to old slave (which has been promoted master) and becomes its slave.

After that, business as usual. Except I would like to promote the slave (old master) to master the way it was in the original layout. This can be done manually with redis-cli (and consequently with cron, I think), but are there any means to do it with sentinel configuration or some other method other than brute cronjob? My intention is basically to have a static master that's backed up by slave, which returns master status once the original master is available again.

share|improve this question
up vote 2 down vote accepted

There's not currently any mechanism for failing back to the intended master. The slave-priority can affect what slave is selecting when the master is down, but won't cause the sentinels to initiate a failback when the current master is healthy. To have this done automatically, you'll need to implement it outside of sentinel.

share|improve this answer

To handle automatically the master election automatically you may want to try the following solutions:

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.