1

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 Answers1

3

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.

Gustav
  • 2,902
  • 1
  • 25
  • 31
  • 2
    +1. Note: starting with Redis 2.8, a partial resynchronization is also possible. But this is different from a partial failover. If your write data is very sensitive and should not get lost, you can do several things. One is, to connect to a slave as well, and use a keyspace notification or other (custom) subscription for a reply 'data is safe'. Another one (depending on the scope) could be a bgsave followed by async checks, which doesn't require slaves at all. – Tw Bert Mar 13 '14 at 02:40
  • @TwBert Good tips! Noted – Gustav Mar 13 '14 at 13:56