Monday, 7 June 2021

What is Voting and not voting members in Replica Set in MongoDB? | Replication in MongoDB | MongoDB

🚀 Master MongoDB with Ram N Java! 🚀

Subscribe to our channel for the simplest and most effective coding tutorials!

🔥 CLICK HERE TO SUBSCRIBE NOW

Voting vs. Non-Voting Members in MongoDB

In a MongoDB Replica Set, not all members are created equal when it comes to decision-making. To manage large clusters efficiently, MongoDB distinguishes between Voting and Non-Voting members.

What are Voting Members?

Voting members are the core of the Replica Set's democracy. These nodes participate in elections to choose a new Primary if the current one fails. By default, MongoDB members have one vote each, and a set can have a maximum of 7 voting members.

What are Non-Voting Members?

As your cluster grows beyond 7 members, additional nodes must be configured as Non-Voting. These members still maintain a copy of the data and can serve "read" requests, but they do not cast a vote during elections. This keeps the election process fast and stable.

Why the Limit?

Limiting the number of voting members to 7 (in a set of up to 50 members total) ensures that the network overhead during an election doesn't become too heavy. It guarantees that a Primary can be elected quickly, minimizing downtime for your application.

No comments:

Post a Comment

Tutorials