Chapter 3: Replication

When two nodes are down why third node will not become primary? What is the concept or reason for it?

Thank you.

Because the 2 other nodes might be inaccessible from the third but can see each other in a broken network. They have the majority and they might be able to elect a new primary. The third node has no way to know that the 2 other nodes are up and running so it remains in standby mode.

3 Likes

Hi @Shashank_Jadon,

In addition to @steevej-1495,

If 2 nodes are down then the third node cannot get the majority of votes that any node require for becoming a Primary and hence it remains in the secondary state (given it’s a P-S-S architecture).

1 Like

If there are 10 nodes and 6 nodes get down then what will happen? Do majority remain same (6) for cluster or it will change and majority will become 3 for 4 nodes cluster?

Thank you.

Majority is always based on the original cluster config. If the cluster is defined with 10 nodes the majority will always be 6.

In addition, as mentioned somewhere in the course, having a even number of nodes in a cluster is not recommended.

1 Like

Hi Shashank,
I think you got the answers from the other replies. On the same note, in a 3 member replica set if two secondaries are down, the primary will step down and become a secondary (until one of the two secondaries are up) making the database unavailable as there is no primary. Thank you.

Hi @Vinny_35540,

Just to add on, in such cases database wouldn’t be available for write operations but you can still configure your application to read from secondaries.

1 Like

Thank you, Ranjan.