Redis replication config

2019-02-20 02:05发布

问题:

I have a redis master setup with 2 slaves and a sentinal on each.

If the master goes down for say 2 seconds (+sdown) and comes back up (-sdown), it reads the last snapshot, and the slaves resync with the master.

The problem with this is that there may have been many writes between the last save and the +sdown. It seems like if the master goes from +sdown to -sdown and never +odown (where a failover is initiated), it should be able to sync FROM a slave. My reasoning is that the replication stream is continuous and the slaves most likely have a more accurate reflection of the masters state when +sdown happened.

Is there some config that I can do this? Am I forced to rely on the AOF or snapshots?

(Edit: adding sentinel tag)

回答1:

You cannot do a partial failover, either you do it or you don't in terms of promoting the slave to master.

From Redis Sentinel:

Automatic failover. If a master is not working as expected, Sentinel can start a failover process where a slave is promoted to master, the other additional slaves are reconfigured to use the new master, and the applications using the Redis server informed about the new address to use when connecting.