forked from mongodb/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
replica-set-secondary.txt
73 lines (52 loc) · 2.24 KB
/
replica-set-secondary.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
62
63
64
65
66
67
68
69
70
71
72
73
=============================
Replica Set Secondary Members
=============================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
.. start-content
A secondary maintains a copy of the :term:`primary's <primary>` data
set. To replicate data, a secondary applies operations from the
primary's :doc:`oplog </core/replica-set-oplog>` to its own data set
in an asynchronous process. A replica set can have one or more
secondaries.
The following three-member replica set has two secondary
members. The secondaries replicate the primary's oplog and apply
the operations to their data sets.
.. include:: /images/replica-set-primary-with-two-secondaries.rst
Although clients cannot write data to secondaries, clients can read
data from secondary members. See :doc:`/core/read-preference` for more
information on how clients direct read operations to replica sets.
A secondary can become a primary.
If the current primary becomes unavailable, the replica set
holds an :term:`election` to choose which of the secondaries
becomes the new primary.
.. start-content-election-example
In the following three-member replica set, the primary becomes unavailable.
This triggers an election where one of the remaining
secondaries becomes the new primary.
.. include:: /images/replica-set-trigger-election.rst
.. end-content-election-example
See
:doc:`/core/replica-set-elections` for more details.
You can configure a secondary member for a specific purpose. You can
configure a secondary to:
- Prevent it from becoming a primary in an election, which allows it to
reside in a secondary data center or to serve as a cold standby. See
:doc:`/core/replica-set-priority-0-member`.
- Prevent applications from reading from it, which allows it to run applications
that require separation from normal traffic. See
:doc:`/core/replica-set-hidden-member`.
- Keep a running "historical" snapshot for use in recovery from
certain errors, such as unintentionally deleted databases. See
:doc:`/core/replica-set-delayed-member`.
.. end-content
.. class:: hidden
.. toctree::
:titlesonly:
/core/replica-set-priority-0-member
/core/replica-set-hidden-member
/core/replica-set-delayed-member