Greetings overflowers,
In Redis sentinel/cluster setup, can we use the WAIT command with the total number of slaves to ensure strong consistency across the Redis servers? Why not?
Kind regards
Greetings overflowers,
In Redis sentinel/cluster setup, can we use the WAIT command with the total number of slaves to ensure strong consistency across the Redis servers? Why not?
Kind regards
WAIT
implements synchronous replication for Redis. Synchronous replication is required but not sufficient in order to achieve strong consistency. Strong consistency is practically the sum of two things:
WAIT does not provide "2". The replication process in Redis is performed by Sentinel or Redis Cluster, and is not able to provide property 2
(since the synchronous replication in Redis is the exception not the rule, so there was no much focus on that aspect). However what Redis replication does is to attempt to promote the slave that appears to preserve the greatest amount of data. While this does not change the theoretical guarantees of Redis failover, that can still lose acknowledged writes, it means that if you use WAIT
, there are more slaves having a given operation into their memory, and in turn it is a lot more likely that in the event of a failover, the operation will be retained. However while this will make a failure mode that discards the acknowledged operation hard to trigger, there always exists a failure mode with this properties.
TLDR: WAIT
does not make Redis linearizable, what it does is to make sure the specified number of slaves will receive the write, that in turn makes failover more robust, but without any hard guarantee.
fsync=always
mode, otherwise during restarts each replica may lose writes making the schema weak. –
Middelburg fsync=always
and RDB will be disabled. The 2 slaves of this master won't be writing any logs. Will this be fully safe (given hard disk of master never crashes), or should I write RDB also in one of the slaves? (I don't feel the need, though.) –
Duchess fsync=always
. –
Lewis © 2022 - 2024 — McMap. All rights reserved.