3 ms·
My first thought for solving that problem would be to always have an odd number of nodes, but I'm interested in how Raft actually handles it, too.
by matchu 12y ago
My first thought for solving that problem would be to always have an odd number of nodes, but I'm interested in how Raft actually handles it, too.
- deathanatos 12y ago> My first thought for solving that problem would be to always have an odd number of nodes, but I'm interested in how Raft actually handles it, too. You don't need an odd number of nodes. Raft requires that a majority of the cluster be able to communicate in order to make forward progress. In the event that a majority can't communicate, no changes to the cluster can be made. This isn't particularly unique to Raft; any distributed consensus algorithm that wishes to maintain consistency has this: if your cluster is split in such a way that a majority can't communicate, you can't both accept writes and prevent the cluster from becoming "split-brained", i.e., having two states, one on each side of the split. If a majority of nodes can communicate, you know that your side of the split is unique in this regard, and can thus keep going. All other splits, not having a majority, will not be able to accept writes. A note about majorities: The definition of majority is "_More than half_ (50%) of some group"; in a cluster of size 5, this is at least 3. In a cluster of size 6, this is at least _4_. Because it is more than half (and not just half), even sized clusters are just fine in Raft: in a 3/3 split in a size 6 cluster, neither side has majority by definition.
- matchu 12y agoYeah, so that's the problem we're talking about: the presentation implied that a split network can still accept writes, because one side will have a majority. But what if neither side does? Is the cluster just in read-only mode? But, as I rephrase the problem, I think I observe that splitting the network in two is a rather general case of partitioning. If we partition each node to be on its own, then of course nobody has a majority, so an odd number of nodes doesn't solve the general partition problem.
- matchu 12y agoedit: And by "general case of partitioning" I mean exactly the opposite. Whoops.