Configure Non-Voting Replica Set Member
Non-voting members allow you to add additional members for read distribution beyond the maximum seven voting members.
The following example configures the fourth, fifth, and sixth replica set members to be non-voting members.
The returned document contains a
membersfield which contains a zero-indexed array of member configuration documents, one document for each member of the replica set.
rs.reconfig()method to reconfigure the replica set with the updated replica set configuration document.
Place voting members so that the
mongod instance or instances that you wish to serve as primary can reach a majority of votes in the event of a network partition.
members[n].priority to control which members are more likely to become primary.
When updating the replica configuration object, access the replica set members in the
members array with the array index. The array index begins with
0. Do not confuse this index value with the value of the
members[n]._id field in each document in the
rs.reconfig()shell method can force the current primary to step down, which causes an election. When the primary steps down, the
mongodcloses all client connections. While this typically takes 10-20 seconds, try to make these changes during scheduled maintenance periods.
- Avoid reconfiguring replica sets that contain members of different MongoDB versions as validation rules may differ across MongoDB versions.