- Replication >
- Replica Set Tutorials >
- Member Configuration Tutorials >
- Adjust Priority for Replica Set Member
Adjust Priority for Replica Set Member¶
On this page
Overview¶
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.
Considerations¶
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.
The value of priority
can be any
floating point (i.e. decimal) number between 0
and 1000
. The
default value for the priority
field is 1
.
To block a member from seeking election as primary, assign it a
priority of 0
. Hidden members
and delayed members have
priority
set to 0
.
For arbiters, the default
priority
value is 1
; however,
arbiters cannot become primary regardless of the configured value.
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.
Procedure¶
Assign the replica set the new configuration.¶
Use rs.reconfig()
to apply the new configuration.
This operation updates the configuration of the replica set using
the configuration defined by the value of cfg
.