问题
In redis cluster specification here https://redis.io/topics/cluster-tutorial it mentions
however note that Redis Cluster does not implement strong consistency even when synchronous replication is used:
it is always possible under more complex failure scenarios that a slave that was not able to receive the write is elected as master.
If I issue WAIT command with
WAIT 0 <No.Of Salves>
then I am forcing at the expense of availability to write data in all the slaves. Could you explain me in this scenario how can synchronous replication doesn't meet consistency requirements as mentioned above https://redis.io/topics/cluster-tutorial
Specifically I want to understand the complex failure scenarios that a slave that was not able to receive the write is elected as master when I issue WAIT 0 <No.OfSlaves>
回答1:
Master node might fail before WAIT returns, i.e. write operations haven't been replicated to all slaves. In this case, some slaves have already synced these write operations, while other haven't. When Redis Cluster tries to elect a new master, it might elect a slave, which haven't been fully synced, and the write is lost forever.
Even if the write operations have been fully synced to all slaves, and one of these slave has been elected as the new master, these write operations might be lost. For example, if the new master is restarted before it dumps these write operations to disk. If this new master comes back before a new election triggered, these write operations have been lost.
来源:https://stackoverflow.com/questions/57349100/redis-synchronous-replication-failure-scenarios