Skip to content

Comment on MongoDB Gotchas and How To Avoid Them

Comments

"However due to the way voting works with MongoDB, you must use an odd number of replica set members."

So what happens if I have 2 sequential failures? Suppose I have a replica set of size 5 and the master fails? The remaining 4 would elect a new master from amongst themselves, right? But then what if this next master also fails? The remaining 3 nodes are still a quorum (3 > 5/2) and thus (theoretically) should be able to elect a master. But am I to understand that they won't be able to do so?

As I understand it, those 4 still think there are 5 nodes in the set (just that one is down) so you can still establish majority voting because the set size is 5.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.