diff --git a/source/tutorial/adjust-replica-set-member-priority.txt b/source/tutorial/adjust-replica-set-member-priority.txt index 2e26d16befc..7615957fcdb 100644 --- a/source/tutorial/adjust-replica-set-member-priority.txt +++ b/source/tutorial/adjust-replica-set-member-priority.txt @@ -4,10 +4,50 @@ Adjust Priority for Replica Set Member .. default-domain:: mongodb -To change the value of the -:data:`~local.system.replset.members[n].priority` in the replica set -configuration, use the following sequence of commands in the -:program:`mongo` shell: +Overview +-------- + +Adjust the priority of a replica set member to change the member's +precedence in :doc:`elections ` for primary +or to prevent a member from becoming primary. + +The number assigned to a member's +:data:`~local.system.replset.members[n].priority` field determines the +value of the field. The higher the number as compared to other +members in the set the higher the priority. + +The value of :data:`~local.system.replset.members[n].priority` can be any +floating point (i.e. decimal) number between ``0`` and ``1000``. The +default value for the :data:`~local.system.replset.members[n].priority` +field is ``1``. + +To block a member from seeking election as primary, assign it a priority +of ``0``. :ref:`Hidden members `, +:ref:`delayed members `, and :ref:`arbiters +` all have +:data:`~local.system.replset.members[n].priority` set to ``0``. + +Considerations +-------------- + +Adjust priority during scheduled maintenance windows. + +Reconfiguring priority can force the current primary to step down, leading +to an election. Before an election the primary closes all open +:term:`client` connections. + +To modify priorities, you update the :data:`~local.system.replset.members` +array in the 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 :data:`~local.system.replset.members[n]._id` field in the +array. + +Procedure +--------- + +To change the :data:`~local.system.replset.members[n].priority` values in +the replica set configuration, use the following sequence of commands in +the :program:`mongo` shell: .. code-block:: javascript @@ -18,49 +58,13 @@ configuration, use the following sequence of commands in the rs.reconfig(cfg) The first operation uses :method:`rs.conf()` to set the local variable -``cfg`` to the contents of the current replica set configuration, which -is a :term:`document`. The next three operations change the +``cfg`` to the contents of the current replica set configuration, which is +a :term:`document`. + +The next three operations change the :data:`~local.system.replset.members[n].priority` value in the ``cfg`` document for the first three members configured in the :data:`members -` array. The final operation calls -:method:`rs.reconfig()` with the argument of ``cfg`` to initialize the -new configuration. - -.. include:: /includes/fact-rs-conf-array-index.rst - -If a member has :data:`~local.system.replset.members[n].priority` set -to ``0``, it is ineligible to become :term:`primary` and will not seek -election. :ref:`Hidden members `, -:ref:`delayed members `, and -:ref:`arbiters ` all have -:data:`~local.system.replset.members[n].priority` set to ``0``. - -All members have a :data:`~local.system.replset.members[n].priority` -equal to ``1`` by default. - -The value of :data:`~local.system.replset.members[n].priority` can be -any floating point (i.e. decimal) number between ``0`` and ``1000``. -Priorities are only used to determine the preference in election. The -priority value is used only in relation to other members. With the -exception of members with a priority of ``0``, the absolute value of -the :data:`~local.system.replset.members[n].priority` value is -irrelevant. - -Replica sets will preferentially elect and maintain the primary status -of the member with the highest -:data:`~local.system.replset.members[n].priority` setting. - -.. warning:: - - Replica set reconfiguration can force the current primary to step - down, leading to an election for primary in the replica - set. Elections cause the current primary to close all open - :term:`client` connections. - - Perform routine replica set reconfiguration during scheduled - maintenance windows. +` array. -.. seealso:: The :ref:`Replica Reconfiguration Usage - ` example revolves around - changing the priorities of the :data:`~local.system.replset.members` - of a replica set. +The final operation calls :method:`rs.reconfig()` with the argument of +``cfg`` to initialize the new configuration.