forked from mongodb/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure-replica-set-secondary-sync-target.txt
54 lines (37 loc) · 1.58 KB
/
configure-replica-set-secondary-sync-target.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
===================================
Configure a Secondary's Sync Target
===================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Overview
--------
Secondaries capture data from the primary member to maintain an up to date
copy of the sets' data. However, by default secondaries may automatically
change their sync targets to secondary members based on changes in the
ping time between members and the state of other members’ replication. See
:doc:`/core/replica-set-sync` and
:doc:`/tutorial/manage-chained-replication` for more information.
For some deployments, implementing a custom replication sync topology may
be more effective than the default sync target selection logic. MongoDB
provides the ability to specify a host to use as a sync target.
To temporarily override the default sync target selection logic, you
may manually configure a :term:`secondary` member's sync target to
temporarily pull :term:`oplog` entries. The following provide access to
this functionality:
- :dbcommand:`replSetSyncFrom` command, or
- :method:`rs.syncFrom()` helper in the :program:`mongo` shell
Considerations
--------------
.. include:: /includes/extracts/rsSyncFrom-behavior-both.rst
Procedure
---------
To use the :dbcommand:`replSetSyncFrom` command in the :program:`mongo` shell:
.. code-block:: javascript
db.adminCommand( { replSetSyncFrom: "hostname<:port>" } );
To use the :method:`rs.syncFrom()` helper in the :program:`mongo` shell:
.. code-block:: javascript
rs.syncFrom("hostname<:port>");