Adjust Priority for Replica Set Member
priority settings of replica set members affect both the timing and the outcome of elections for primary. Higher-priority members are more likely to call elections, and are more likely to win. Use this setting to ensure that some members are more likely to become primary and that others can never become primary.
To modify priorities, you update the
members array in the replica configuration object. The array index begins with
0. Do not confuse this index value with the value of the replica set member’s
members[n]._id field in the array.
The value of
priority can be any floating point (i.e. decimal) number between
1000. The default value for the
priority field is
Changed in version 3.6: Starting in MongoDB 3.6, arbiters have priority
0. When you upgrade a replica set to MongoDB 3.6, if the existing configuration has an arbiter with priority
1, MongoDB 3.6 reconfigures the arbiter to have priority
Adjust priority settings during a scheduled maintenance window. Reconfiguring priority can force the current primary to step down, leading to an election. Before an election, the primary closes all open client connections.
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.
rs.reconfig() to apply the new configuration.
This operation updates the configuration of the replica set using the configuration defined by the value of