# Replica Set - Majority / Voting Rights

The lecture states that a replica set can have up to 50 members, but only 7 members can be voting members. Out of these 7 members 1 will be Primary, while the remaining 6 can run for elections.

Question 1: Are we saying that only voting members can run for elections? Can’t we have a member who is a non-voting member but can still have a priority of 1 or above, so that it can be elected as a Primary. To re-frame my question, can’t we have a member in RS, with votes : 0 and priority : 1 or above.

Question 2: How can 7 voting members in a RS of 50 work as per RAFT protocol. My understanding is that for an election in a RS of 50 members, we need a majority i.e. 26 members available for voting. So if we have set only 7 members as voting-members, then we don’t have a majority, so all will work as Secondary without a Primary?

Question 3: In a 3 member RS, if I set one of the members with {votes : 0}, then on what basis do we determine the number that makes up the majority? Will the majority be determined based on the number of voting-members only or is it based on the total number of members in the RS (irrespective of their voting rights)?

Can anybody from the MongoDB Univ. TA team help with the above 3 questions please?

I can answer part of the question. The node which is standing for election only needs a majority of the voting nodes, not a majority of all nodes in the replica set. So if 7 of our 50 nodes are voting nodes, 4 votes constitutes a majority.

Hi @PuneetC,

Version 3.2 onwards:

For a replica set, 7 is the upper limit on the number of voting members. So, as mentioned by @Simon_39939, if we have x number of voting nodes (x<=7), then majority among those x voting nodes will be considered.
This limit on voting members is necessary because if we have a large replica set, then every time an election is triggered, it will take lesser time to elect a new primary. There will be network latency if all the nodes in the replica set take part in election.

In this case, the another secondary should step up to become primary because when you make one of the secondaries non voting member, then its priority will also be 0.

I hope these explanations help!!

Please let me know, if you have any further questions.

Thanks,
Sonali

Not sure, if you have completely understood my question. Let me elaborate here…

The lecture mentioned that in a 3 node RS, the majority of 3 is 2. So 2 members should be available for the election to happen. If 2 members are not available then the election can’t happen. Further, the lecture stated that even if out of the 3 members in a RS, if primary is available, but the 2 secondaries go down then the majority is not achieved, hence the primary will have to step down and become a secondary until any of the secondaries come up and rejoins the RS. To summarize, in a 3 member RS, the majority is 2, so for the election process to even commence at least 2 members should be available.

In the same context, what will be the majority required for a 50 member RS, where 7 members are voting members. Is it going to be 26 (i.e. majority of 50) or is it going to be 4 (majority of 7) ?

My question is not about the majority of votes one needs to get to win the election. Rather, I am asking what is the majority number of nodes that should be available, so that the election process can take place (irrespective of what number of votes one needs to win)

Hi @PuneetC,

In a three member replica set, if both the secondaries go down, then the election cannot take place because in three member replica set, all are voting members and thus majority is 2. However in a bigger replica set, we have to ensure the majority of the voting members.

Please let me know, if you have any questions.

Thanks,
Sonali

So are we saying that in a 50 member RS, with 7 voting members, we need at least 4 voting members (i.e. majority of 7 ) to be up and running, for this Replica Set to function and perform elections (if any topology change is triggered)?

Furthermore, in this 50 member RS with 7 voting members, assuming that 4 voting members were up and running, while 3 were down, and the current PRIMARY decided to steps down to become a SECONDARY which triggered an election. During this election round, that voting member (out of the available 4), who gets the majority votes out of total possible votes of 4 (as only 4 voting members are currently available) will win the round and become the next PRIMARY.

Is this understanding correct ??

Hi @PuneetC,

Correct!!!

If out of 7 voting members, 3 are down, then the remaining 4 will participate in the elections and one of those nodes will become the PRIMARY.

Thanks,
Sonali

@Sonali_Mamgain thank you!!