Adjust Priority for Replica Set Member¶
The priority settings of replica set members affect the outcomes of elections for primary. Use this setting to ensure that some members are more likely to become primary and that others can never become primary.
The value of the member’s priority setting determines the member’s priority in elections. The higher the number, the higher the priority.
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 _id field in the array.
Adjust priority 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.
Change each member’s priority value.¶
cfg.members.priority = 0.5 cfg.members.priority = 2 cfg.members.priority = 2
This sequence of operations modifies the value of cfg to set the priority for the first three members defined in the members array.