3

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.

3

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.

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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