@@ -4,63 +4,45 @@ Adjust Priority for Replica Set Member
4
4
5
5
.. default-domain:: mongodb
6
6
7
- To change the value of the
8
- :data:`~local.system.replset.members[n].priority` in the replica set
9
- configuration, use the following sequence of commands in the
10
- :program:`mongo` shell:
11
-
12
- .. code-block:: javascript
13
-
14
- cfg = rs.conf()
15
- cfg.members[0].priority = 0.5
16
- cfg.members[1].priority = 2
17
- cfg.members[2].priority = 2
18
- rs.reconfig(cfg)
19
-
20
- The first operation uses :method:`rs.conf()` to set the local variable
21
- ``cfg`` to the contents of the current replica set configuration, which
22
- is a :term:`document`. The next three operations change the
23
- :data:`~local.system.replset.members[n].priority` value in the ``cfg``
24
- document for the first three members configured in the :data:`members
25
- <local.system.replset.members>` array. The final operation calls
26
- :method:`rs.reconfig()` with the argument of ``cfg`` to initialize the
27
- new configuration.
28
-
29
- .. include:: /includes/fact-rs-conf-array-index.rst
30
-
31
- If a member has :data:`~local.system.replset.members[n].priority` set
32
- to ``0``, it is ineligible to become :term:`primary` and will not seek
33
- election. :ref:`Hidden members <replica-set-hidden-members>`,
34
- :ref:`delayed members <replica-set-delayed-members>`, and
35
- :ref:`arbiters <replica-set-arbiters>` all have
7
+ Overview
8
+ --------
9
+
10
+ The priority settings of replica set members affect the outcomes
11
+ of :doc:`elections </core/replica-set-elections>` for primary. Use this
12
+ setting to ensure that some members are more likely to become primary and
13
+ that others can never become primary.
14
+
15
+ The value of the member's
16
+ :data:`~local.system.replset.members[n].priority` setting determines the
17
+ member's priority in elections. The higher the number, the higher the
18
+ priority.
19
+
20
+ Considerations
21
+ --------------
22
+
23
+ To modify priorities, you update the :data:`~local.system.replset.members`
24
+ array in the the replica configuration object. The array index begins with
25
+ ``0``. Do **not** confuse this index value with the value of the replica
26
+ set member's :data:`~local.system.replset.members[n]._id` field in the
27
+ array.
28
+
29
+ The value of :data:`~local.system.replset.members[n].priority` can be any
30
+ floating point (i.e. decimal) number between ``0`` and ``1000``. The
31
+ default value for the :data:`~local.system.replset.members[n].priority`
32
+ field is ``1``.
33
+
34
+ To block a member from seeking election as primary, assign it a priority
35
+ of ``0``. :ref:`Hidden members <replica-set-hidden-members>`,
36
+ :ref:`delayed members <replica-set-delayed-members>`, and :ref:`arbiters
37
+ <replica-set-arbiters>` all have
36
38
:data:`~local.system.replset.members[n].priority` set to ``0``.
37
39
38
- All members have a :data:`~local.system.replset.members[n].priority`
39
- equal to ``1`` by default.
40
-
41
- The value of :data:`~local.system.replset.members[n].priority` can be
42
- any floating point (i.e. decimal) number between ``0`` and ``1000``.
43
- Priorities are only used to determine the preference in election. The
44
- priority value is used only in relation to other members. With the
45
- exception of members with a priority of ``0``, the absolute value of
46
- the :data:`~local.system.replset.members[n].priority` value is
47
- irrelevant.
48
-
49
- Replica sets will preferentially elect and maintain the primary status
50
- of the member with the highest
51
- :data:`~local.system.replset.members[n].priority` setting.
52
-
53
- .. warning::
54
-
55
- Replica set reconfiguration can force the current primary to step
56
- down, leading to an election for primary in the replica
57
- set. Elections cause the current primary to close all open
58
- :term:`client` connections.
40
+ Adjust priority during a sheduled maintenance window. Reconfiguring
41
+ priority can force the current primary to step down, leading to an
42
+ election. Before an election the primary closes all open :term:`client`
43
+ connections.
59
44
60
- Perform routine replica set reconfiguration during scheduled
61
- maintenance windows.
45
+ Procedure
46
+ ---------
62
47
63
- .. seealso:: The :ref:`Replica Reconfiguration Usage
64
- <replica-set-reconfiguration-usage>` example revolves around
65
- changing the priorities of the :data:`~local.system.replset.members`
66
- of a replica set.
48
+ .. include:: /includes/steps/adjust-replica-set-member-priority.rst
0 commit comments