What is? redis Cluster cleft of brain ?
redis Cluster cleft refers to network problems , cause redis master Node heel redis
slave Node and sentinel The cluster is in different network partitions , At this time, because sentinel The cluster is not aware of it master The existence of , So will slave Node promoted to master node . There are two different master node , It's like one brain split into two .

Cluster cleft , If the client is still based on the original master The node continues to write data , So new master The node will not be able to synchronize the data , When the network problem is solved ,sentinel Cluster will be the original master Node is reduced to slave node , At this time, the new master Synchronize data in , It will cause a lot of data loss .
Solution
redis In the configuration file of , There are two parameters
min-slaves-to-write 3 min-slaves-max-lag 10
The first parameter represents the connection to master The least slave number
The second parameter represents slave connection to master Maximum delay time of

Follow the above configuration , Require at least 3 individual slave node , And the delay of data replication and synchronization cannot exceed 10 second , Otherwise master Will refuse to write the request , After these two parameters are configured , If cluster cleft occurs , Original master The node will reject the write request from the client , It can reduce data loss after data synchronization .

be careful : Newer version of redis.conf The parameters in the file become
min-replicas-to-write 3 min-replicas-max-lag 10
redis These two parameters can also be used for data loss in the case of asynchronous replication in

Technology