1

What if all nodes in replica set goes down, except 1 secondary node. Unable to do operation with secondary node. Neither it selects itself as primary node.

Roshan
  • 13
  • 1
  • 3

2 Answers2

1

I have recently tested the case of network partitioning when all replica set members are inaccessible for each other. Regarding to the documentation When the primary detects that it can only see a minority of nodes in the replica set, the primary steps down as primary and becomes a secondary. Independently, a member in the partition that can communicate with a majority of the nodes (including itself) holds an election to become the new primary. This is why it should be odd number of nodes in a replica set. In case when only two nodes in cluster, primary will only be elected if both of them are available. If one of the nodes goes down, another one becomes secondary. If you need exactly two members in your replica set you can use arbiter running on one of the members.

https://docs.mongodb.com/manual/core/replica-set-elections/

0

It will become primary. I haven't played multiple replica. I tested single replica sets. If primary server die another will become primary. In my case I use arbiter to vote the servers.

Mohan
  • 1
  • 1