-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
configure-secondary-only-replica-set-member.txt
61 lines (42 loc) · 1.76 KB
/
configure-secondary-only-replica-set-member.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
=======================================
Prevent Secondary from Becoming Primary
=======================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Overview
--------
In a replica set, by default all :term:`secondary` members are eligible to
become primary through the election process. You can use the
:data:`priority <replSetGetConfig.members[n].priority>` to affect the
outcome of these elections by making some members more likely to become
primary and other members less likely or unable to become primary.
Secondaries that cannot become primary are also unable to trigger
elections. In all other respects these secondaries are identical to other
secondaries.
To prevent a :term:`secondary` member from ever becoming a :term:`primary`
in a :term:`failover`, assign the secondary a priority of ``0``, as
described here. For a detailed description of secondary-only members and their purposes,
see :doc:`/core/replica-set-priority-0-member`.
Considerations
--------------
.. include:: /includes/fact-rs-conf-array-index.rst
.. note::
MongoDB does not permit the current :term:`primary` to have a priority
of ``0``. To prevent the current primary from again becoming a primary,
you must first step down the current primary using
:method:`rs.stepDown()`.
Procedure
---------
This tutorial uses a sample replica set with 5 members.
.. include:: /includes/warning-rs-reconfig.rst
.. include:: /includes/steps/configure-secondary-only-rs-member.rst
Related Documents
-----------------
- :rsconf:`members[n].priority`
- :doc:`/tutorial/adjust-replica-set-member-priority`
- :ref:`Replica Set Reconfiguration <replica-set-reconfiguration-usage>`
- :doc:`/core/replica-set-elections`