@@ -715,28 +715,29 @@ To do so, use one of the following approaches:
715
715
716
716
Automatically Resync a Stale Member
717
717
```````````````````````````````````
718
-
719
718
This procedure relies on MongoDB's regular process for initial
720
719
sync. This will restore the data on the stale member to reflect the
721
720
current state of the set. For an overview of MongoDB initial sync
722
721
process, see the :ref:`replica-set-syncing` section.
723
722
724
723
To resync the stale member:
725
724
726
- 1. Stop the member's :program:`mongod` instance using the
727
- :option:`mongod --shutdown` option. Make sure to set
725
+ 1. Stop the stale member's :program:`mongod` instance/process.
726
+ One way to do this is to run
727
+ :option:`mongod --shutdown` on the stale member machine. Set
728
728
:option:`--dbpath <mongod --dbpath>` to the member's data
729
729
directory, as in the following:
730
730
731
731
.. code-block:: sh
732
732
733
733
mongod --dbpath /data/db/ --shutdown
734
734
735
- #. Delete all data and sub-directories from the member's data directory
736
- such that the directory is empty.
735
+ #. Delete all data and sub-directories from the member's data directory.
736
+ We do this so that we can then resync from a completely clean and empty
737
+ data image for the stale member.
738
+ Consider making a backup first.
737
739
738
- #. Restart the :program:`mongod` instance on the member. Consider the
739
- following example:
740
+ #. Restart the :program:`mongod` instance on the member. For example:
740
741
741
742
.. code-block:: sh
742
743
@@ -746,29 +747,30 @@ To resync the stale member:
746
747
take a long time, depending on the size of the database and speed
747
748
of the network. Remember that this operation may have an impact on
748
749
the working set and/or traffic to existing primary other members of
749
- the set.
750
+ the set. Note the initial sync can only occur if another member of the set is
751
+ up and healthy (that member will be the source for syncing).
750
752
751
753
.. index:: replica set; resync
752
754
.. _replica-set-resync-by-copying:
753
755
754
- Resync by Copying Data from Another Member
756
+ Resync by Copying All Datafiles from Another Member
755
757
``````````````````````````````````````````
756
758
757
- This approach uses the data directory of an existing member to "seed"
758
- the stale member. The data must be recent enough to allow the new member
759
- to catch up with the :term:`oplog`.
760
-
761
- To resync by copying data from another member, use one of the following
762
- approaches:
763
-
764
- - Create a snapshot of another member's data and then restore that
765
- snapshot to the stale member. Use the snapshot procedures in
766
- :doc:`/administration/backups`.
767
-
768
- - Lock another member's data with the :method:`db.fsyncLock()`
769
- command, copy all of the data in the data directory, and then restore the data to the stale
770
- member. Use the procedures for backup storage in
771
- :doc:`/administration/backups` .
759
+ This approach uses the datafiles of a healthy member of the replica set
760
+ (or a restored backup thereof)
761
+ to "seed" the stale member. Note the data image must be recent enough to allow the new member
762
+ to catch up with the :term:`oplog`; an older backup would likely be too stale.
763
+
764
+ Note that in general you cannot simply copy the datafiles from another replica
765
+ set member if it is running, as that mongod will likely be changing those datafiles
766
+ while our copy is underway; thus in our image will not automatically be consistent.
767
+ There are several approaches to get a consistent image from another server; these
768
+ approaches are analogous to making a backup of the datafiles on that server. See the
769
+ :doc:`/administration/backups` page for details.
770
+
771
+ Once you have copied all datafiles (including subdirectories) from the other set member,
772
+ restart the local mongod and it should come online after catching up on any write operations
773
+ which have occurred in the cluster since the time of the restore image .
772
774
773
775
.. _replica-set-security:
774
776
0 commit comments