There's more...
Actually, before the FAIL message, there is a PFAIL (possible failure) state propagated among the nodes in the cluster. The state PFAIL means that a node, no matter if it's a master or a slave, can flag another node as PFAIL if another node is unreachable. It then propagates this information through the heartbeat. Node A first sets node B as PFAIL. Then, when A receives PFAIL or FAIL of B from the majority of masters within NODE_TIMEOUT * 2, it will modify PFAIL to FAIL and broadcast the message to other nodes.
So, in our example, if we crashed two masters almost at the same time, the Cluster won't do the failover even if the two masters have their slaves separately. That is because the majority of masters are down. As a result, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access