1

Consider the following setup for a redis high-availability solution: 3 VMs each running an instance of redis server and an instance of sentinel to monitor the setup. R1 (redis on VM1) is configured as a master, R2 and R3 as slaveof R1; S1... S3 (sentinels) all monitor R1 with quorum of 2. All of this is statically written into redis.conf and redis-sentinel.conf on the corresponding VMs.

Now consider VM1 (carrying R1 and S1) goes down. The sentinels elect e.g. R2 as a new master and the client code, jedis, automatically adapts itself to the new state. So far so good.

What exactly happens when VM1 is brought back up and R1 and S1 become available?

In particular:

  • Will R1 join the remaining R2 and R3 to form a 3-node setup again (e.g. because S2 and S3 keep monitoring it)?
  • If yes, will R1 get elected back to master or will remain a slave? Should I care at all?
  • Will S1 join S2 and S3 to form a 3-node setup again?
  • Will jedis adapt automatically?
Oleg Sklyar
  • 9,834
  • 6
  • 39
  • 62

1 Answers1

1

Sentinel will convert the old master to a slave of the new master and nothing needs to change unless another failover happens in which case this is all repeated. The detail are at the sentinel docs which directly answer your question for sentinel.

Jedis won't need to care about the old master rejoining as a slave.

The Real Bill
  • 14,884
  • 8
  • 37
  • 39