Brett McLain
Brett McLain

Reputation: 2010

Last mongo replica set becomes secondary?

I have 3 mongo nodes set up as replica sets. The following scenario is occurring:

This doesn't make sense to me...I would expect the primary to remain primary. Can someone explain this to me? I've read that perhaps I need an arbiter to make the election in the case that only a single node survives, however this feels clunky. Why can't a single node make the election?

Upvotes: 1

Views: 942

Answers (1)

robjwilkins
robjwilkins

Reputation: 5652

With a 3 node replicaset you need a minimum of 2 nodes up. The docs refer to a 'majority' required to elect a new primary. Therefore with a 3 node RS, there needs to be at least 2 nodes running for one node to be assigned as primary.

This page has a quite useful table showing the fault tolerance for replicasets with different numbers of nodes: https://docs.mongodb.org/manual/core/replica-set-architectures/

Upvotes: 2

Related Questions