mongodbreplicasetleader-election

MONGO election primary


I had a replica set with 5 mongo nodes I shut 3 nodes for DR testing and add a new node to replica. however, even though one node has higher priority I still have 3 secondaries nodes and no primary. do you know why, what should be done how can I fix it


Solution

  • When you shut down 3 out of 5 nodes, you lost the ability to have a primary since a majority of nodes must vote for the primary.

    When you added a new node, the new node had to sync data from the primary before it could become a new primary. Since there was no primary this sync couldn't have happened.

    Your DR plans need to ensure there is always a majority of nodes operational.