Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Redis同步复制失败场景_Redis - Fatal编程技术网

Redis同步复制失败场景

Redis同步复制失败场景,redis,Redis,在redis集群规范中,它提到 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 el

在redis集群规范中,它提到

    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.
如果我发出WAIT命令

WAIT 0 <No.Of Salves>
等待0
然后我以牺牲可用性为代价强制在所有从机中写入数据。在这个场景中,您能解释一下同步复制如何不能满足上面提到的一致性要求吗


具体来说,我想了解一种复杂的故障情况,即当我发出
等待0

主节点时,无法接收写入的从节点被选为主节点,在等待返回之前可能会失败,即写入操作尚未复制到所有从节点。在这种情况下,一些从机已经同步了这些写入操作,而另一些从机没有。当Redis Cluster尝试选择一个新的主节点时,它可能会选择一个尚未完全同步的从节点,写入操作将永远丢失

即使写操作已完全同步到所有从机,并且其中一个从机已被选为新的主机,这些写操作也可能会丢失。例如,如果新主机在将这些写入操作转储到磁盘之前重新启动。如果此新主机在触发新选择之前返回,则这些写入操作已丢失