Reputation: 11
I'm facing some issues when trying the following:
having a three-node MongoDB 4.0 cluster, no sharding, one mongodb instance as primary, the rest, secondaries. when I shut down the primary, one of the secondaries becomes the master, the other remains as such when I shut down the new primary (former secondary), the remain secondary don't become master, so cluster stays inoperative
I've been following steps as documentation dictates, so there should be some configuration I forgot. I even change the order of creation, I always get the same result
What am I doing wrong?
Thanks in advance.
Upvotes: 0
Views: 94
Reputation: 10737
Election process need 'majority' to elect PRIMARY , e.g. when you have 2 nodes down from 3 , there will be no majority of nodes to elect the new PRIMARY so the 3th node will stay in SECONDARY until you start at least one of the other members.
Upvotes: 0
Reputation: 14476
MongoDB cannot automatically failover to a single member, this is due to how elections work.
If you think about this logically, if there was a network partition between both the primary and secondary, how would either of them know if one or the other is down... so they both step down to be secondaries until one or the other can see the majority of the node.
https://docs.mongodb.com/manual/core/replica-set-elections/#network-partition
A network partition may segregate a primary into a partition with a minority of nodes. 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.
Upvotes: 1