What is redis cluster brain fissure? How to solve it?
What is redis cluster schisencephaly?
Redis cluster brain split refers to network problems, resulting in redis master node and redis slave node and sentinel cluster in different network partitions, at this time because sentinel cluster can not sense the existence of master node, so the slave node will be promoted to master node.
There are two different master nodes, just like a brain splitting into two.
In the cluster brain split problem, if the client continues to write data based on the original master node, then the new master node will not be able to synchronize these data. When the network problem is solved, the sentinel cluster will reduce the original master node to a slave node, and then synchronize the data from the new master node, which will cause a lot of data loss.
solutions
There are two parameters in the redis configuration file
min-slaves-to-write 3
min-slaves-max-lag 10
The first parameter indicates the minimum number of slaves connected to the master
The second parameter indicates the maximum latency for slave to master connections
If the number of slaves connected to the master is less than the first parameter, and the ping delay time is less than or equal to the second parameter, then the master will reject the write request. After configuring these two parameters, if the cluster brain split occurs, the original master node will reject the write request received by the client, which can reduce the data loss after data synchronization.
Note: The parameters in the redis.conf file in newer versions change to
min-replicas-to-write 3
min-replicas-max-lag 10
The data loss problem in asynchronous replication cases in redis can also use these two parameters
The above is the detailed content of how many nodes redis split brain, please pay more attention to other related articles!