分布式系统 - 脑裂
Split brain in a distributed system is a problem that can occur in consistent systems. If a network partition occurs in a consistent system then one side or the other (or both) of the partition needs to stop responding to requests to maintain the consistency guarantee. If both sides continue to respond to reads and writes while they are unable to communicate with each other they will diverge and no longer be consistent. This state where both sides of the partition remain available is called split brain.
在分布式系统中脑裂是一个系统中可能出现的问题。 如果网络分区出现在一致的系统中,则分区的一侧或另一侧(或两者)需要停止响应维护一致性保证的请求。 如果双方在无法相互通信的情况下继续响应读写,则它们会发散并且不再一致。 分区两侧保持可用的状态称为脑裂。
比如对于Raft协议的实现,网络分区导致两个leader产生,这个就是出现了脑裂现象,如果两个leader同时处理客户端的写请求,就会导致数据一致性问题。Raft协议肯定是要考虑这种情况,使得就算是出现脑裂也不会影响系统的数据一致性。Raft协议中通过选举的限制和日志复制的一些控制来解决脑裂问题。