Skip to content

Commit f5d122b

Browse files
author
Bob Grabar
committed
DOCS-941 replication chaining
1 parent e8eefb5 commit f5d122b

File tree

2 files changed

+102
-10
lines changed

2 files changed

+102
-10
lines changed

source/administration/replica-sets.txt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,30 @@ the event of a network partition.
339339
.. seealso:: :data:`~local.system.replset.settings.members[n].votes` and :ref:`Replica Set
340340
Reconfiguration <replica-set-reconfiguration-usage>`.
341341

342+
.. _replica-set-chained-replication:
343+
344+
Chained Replication
345+
~~~~~~~~~~~~~~~~~~~
346+
347+
Chained replication occurs when a :term:`secondary` member replicates
348+
from another secondary member instead of from the :term:`primary`. This
349+
might be the case, for example, if a secondary selects its replication
350+
target based on ping time and if the closest member is another secondary.
351+
352+
Chained replication has the benefit of providing load balancing in cases
353+
where the primary is heavily loaded. But, depending on the network
354+
topology, replication chaining can also result in increased replication
355+
lag.
356+
357+
.. versionadded:: 2.2.2
358+
359+
You can use the
360+
:data:`chainingAllowed <local.system.replset.settings.chainingAllowed>`
361+
setting in
362+
:doc:`/reference/replica-configuration` to disable chained replication
363+
for situations where replication lag is an issue. For details, see
364+
:ref:`replica-set-config-chained-replication`.
365+
342366
Procedures
343367
----------
344368

@@ -586,6 +610,54 @@ after the initial sync operation.
586610

587611
.. include:: /includes/fact-replica-set-sync-from-is-temporary.rst
588612

613+
.. _replica-set-config-chained-replication:
614+
615+
Enable or Disable Chained Replication
616+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
617+
618+
.. versionadded:: 2.2.2
619+
620+
:ref:`replica-set-chained-replication` is enabled by default. This
621+
procedure describes how to disable it and how to re-enable it.
622+
623+
To disable chained replication, set the
624+
:data:`local.system.replset.settings.chainingAllowed`
625+
field in :doc:`/reference/replica-configuration` to ``false``.
626+
627+
You can use the following sequence of commands to set ``chainingAllowed`` to
628+
``false``:
629+
630+
1. Copy the configuration settings into the ``cfg`` object:
631+
632+
.. code-block:: javascript
633+
634+
cfg = rs.conf()
635+
636+
#. Take note of whether the current configuration settings contain the
637+
``settings`` sub-document. If they do, skip this step.
638+
639+
.. warning:: To avoid data loss, skip this step if the configuration
640+
settings contain the ``settings`` sub-document.
641+
642+
If the current configuration settings **do not** contain the
643+
``settings`` sub-document, create the sub-document by issuing the
644+
following command:
645+
646+
.. code-block:: javascript
647+
648+
cfg.settings = { }
649+
650+
#. Issue the following sequence of commands to set ``chainingAllowed``
651+
to ``false``:
652+
653+
.. code-block:: javascript
654+
655+
cfg.settings.chainingAllowed = false
656+
rs.reconfig(cfg)
657+
658+
To re-enable chained replication, use :dbcommand:`replSetSyncFrom` to
659+
specify that each secondary replicates from the primary.
660+
589661
.. _replica-set-procedure-change-oplog-size:
590662

591663
Changing Oplog Size

source/reference/replica-configuration.txt

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,27 @@ Configuration Variables
217217

218218
**Type**: :term:`MongoDB Document <document>`
219219

220-
The setting document holds two optional fields, which affect the
221-
available :term:`write concern` options and default configurations.
220+
The settings document affects replication chaining and
221+
available :term:`write concern` options.
222+
223+
.. data:: local.system.replset.settings.chainingAllowed
224+
225+
*Optional*.
226+
227+
**Type**: boolean
228+
229+
**Default**: true
230+
231+
When this value is ``true``, the replica set allows :term:`secondary`
232+
members to replicate from other secondary members. When this value is
233+
``false``, secondaries can replicate only from the :term:`primary`.
234+
235+
When you run :method:`rs.conf()` to view a replica set's
236+
configuration, the ``chainingAllowed`` field appears only when it is
237+
set to ``false``. If ``chainingAllowed`` is set to its default value
238+
of ``true``, the field does not appear.
239+
240+
.. seealso:: :ref:`replica-set-chained-replication`
222241

223242
.. data:: local.system.replset.settings.getLastErrorDefaults
224243

@@ -261,19 +280,20 @@ all optional fields.
261280
{
262281
_id : <ordinal>,
263282
host : hostname<:port>,
264-
<arbiterOnly : <boolean>,>
265-
<buildIndexes : <boolean>,>
266-
<hidden : <boolean>,>
267-
<priority: <priority>,>
268-
<tags: { <document> },>
269-
<slaveDelay : <number>,>
283+
<arbiterOnly : <boolean> >,
284+
<buildIndexes : <boolean> >,
285+
<hidden : <boolean> >,
286+
<priority: <priority> >,
287+
<tags: { <document> } >,
288+
<slaveDelay : <number> >,
270289
<votes : <number>>
271290
}
272291
, ...
273292
],
274293
<settings: {
275-
<getLastEerrorDefaults : <lasterrdefaults>,>
276-
<getLastErrorModes : <modes>>
294+
<chainingAllowed : <boolean> >,
295+
<getLastEerrorDefaults : <lasterrdefaults> >,
296+
<getLastErrorModes : <modes> >
277297
}>
278298
}
279299

0 commit comments

Comments
 (0)