Skip to content

Commit cfd3cc1

Browse files
author
Ed Costello
committed
Merge pull request #544 from bgrabar/secondaries-154
DOCS-154 DOCS-816 add 2.2 replica set behaviors
2 parents f20a604 + f684195 commit cfd3cc1

File tree

4 files changed

+64
-5
lines changed

4 files changed

+64
-5
lines changed

source/administration/replica-sets.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,30 @@ resource requirements and do not require dedicated hardware.
556556

557557
rs.addArb("m1.example.net:30000")
558558

559+
.. _replica-set-configure-sync-target:
560+
561+
Manually Configure a Secondary's Sync Target
562+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
563+
564+
To override the default selection logic, if needed, and to manually
565+
configure a :term:`secondary` member's sync target for pulling
566+
:term:`oplog` entries, use either of the following commands. If you want
567+
your choice to affect the initial sync, run the command *before* initial
568+
sync. Always exercise caution when overriding the default behavior:
569+
570+
- :dbcommand:`replSetSyncFrom` command
571+
572+
- :method:`rs.syncFrom()` helper in the :program:`mongo` shell
573+
574+
These commands do not work *during* initial sync. To affect initial
575+
sync, you must specify a target *before* initial sync starts.
576+
If you run one of the commands during initial sync, no error message
577+
appears, but the sync target does not change until initial sync completes.
578+
579+
These commands provide a temporary override of default behavior. The
580+
change does not persist if the :program:`mongod` instance or the sync
581+
socket closes.
582+
559583
.. _replica-set-procedure-change-oplog-size:
560584

561585
Changing Oplog Size

source/core/replication-internals.txt

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,17 +261,17 @@ set members sync, or copy, :term:`oplog` entries from other members.
261261
When a new member joins a set or an existing member restarts, the
262262
member waits to receive heartbeats from other members. By
263263
default, the member syncs from the *the closest* member of the
264-
set that is either the primary or another secondary with more recent
265-
oplog entries. This prevents two secondaries from syncing from each other.
264+
set that is either the primary or another :term:`secondary` with more recent
265+
oplog entries.
266266

267267
In version 2.0, secondaries only change sync targets if the connection
268-
between secondaries drops or produces an error.
268+
to the sync target drops or produces an error.
269269

270270
For example:
271271

272272
#. If you have two secondary members in one data center and a primary in
273273
a second facility, and if you start all three instances at roughly
274-
the same time (i.e. with no existing data sets or oplog,) both
274+
the same time (i.e. with no existing data sets or oplog), both
275275
secondaries will likely sync from the primary, as neither secondary
276276
has more recent oplog entries.
277277

@@ -283,4 +283,28 @@ For example:
283283
facility, the new secondary will likely sync from the existing
284284
secondary because it is closer than the primary.
285285

286-
.. seealso:: :ref:`replica-set-resync-stale-member`
286+
In version 2.2, secondaries also use the following additional sync
287+
behaviors:
288+
289+
- Secondaries will sync from :ref:`delayed members
290+
<replica-set-delayed-members>` *only* if no other member is available.
291+
292+
- Secondaries will *not* sync from :ref:`hidden members
293+
<replica-set-hidden-members>`.
294+
295+
- Secondaries will *not* start syncing from a member in a
296+
:term:`recovering` state.
297+
298+
- For one member to sync from another, both members must have the same
299+
value, either ``true`` or ``false``, for the
300+
:data:`members[n].buildIndexes` field.
301+
302+
Pre-Fetching Indexes to Improve Replication Throughput
303+
------------------------------------------------------
304+
305+
By default, secondaries will in most cases pre-fetch :ref:`indexes`
306+
associated with the affected document to improve replication throughput.
307+
308+
You can limit this feature to pre-fetch only the index on the ``_id``
309+
field, or you can disable this feature entirely. For more information,
310+
see :setting:`replIndexPrefetch`.

source/reference/command/replSetSyncFrom.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ replSetSyncFrom
3030
behind the current member, :program:`mongod` will return and log a
3131
warning, but *will* sync from such members.
3232

33+
If you attempt to change a member's sync target *during* initial
34+
sync, the change will not take effect until initial sync completes.
35+
No error message appears, but the sync target does not change until
36+
after initial sync.
37+
3338
The command has the following prototype form:
3439

3540
.. code-block:: javascript

source/release-notes/2.2.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,8 @@ identify what process may produce errors or halt replication. See
666666
Replica Set Members can Sync from Specific Members
667667
``````````````````````````````````````````````````
668668

669+
.. the following has been copied to source/administration/replica-sets.txt
670+
669671
The new :dbcommand:`replSetSyncFrom` command and new
670672
:method:`rs.syncFrom()` helper in the :program:`mongo` shell make it
671673
possible for you to manually configure from which member of the set a
@@ -677,6 +679,8 @@ behavior.
677679
Replica Set Members will not Sync from Members Without Indexes Unless ``buildIndexes: false``
678680
`````````````````````````````````````````````````````````````````````````````````````````````
679681

682+
.. the following has been copied to source/core/replication-internals.txt
683+
680684
To prevent inconsistency between members of replica sets, if the
681685
member of a replica set has :data:`members[n].buildIndexes` set to
682686
``true``, other members of the replica set will *not* sync from this
@@ -686,6 +690,8 @@ member, unless they also have :data:`members[n].buildIndexes` set to
686690
New Option To Configure Index Pre-Fetching during Replication
687691
`````````````````````````````````````````````````````````````
688692

693+
.. the following has been copied to source/core/replication-internals.txt
694+
689695
By default, when replicating options, :term:`secondaries <secondary>`
690696
will pre-fetch :ref:`indexes` associated with a query to improve replication
691697
throughput in most cases. The :setting:`replIndexPrefetch` setting and

0 commit comments

Comments
 (0)