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 remainingR2
andR3
to form a 3-node setup again (e.g. becauseS2
andS3
keep monitoring it)? - If yes, will
R1
get elected back to master or will remain a slave? Should I care at all? - Will
S1
joinS2
andS3
to form a 3-node setup again? - Will
jedis
adapt automatically?