Skip to content

Commit 7c428ab

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-33862-mongorestore-example (#146)
* DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example * DOCSP-33862-mongorestore-example --------- Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 1a12b3b commit 7c428ab

File tree

3 files changed

+64
-24
lines changed

3 files changed

+64
-24
lines changed

source/mongodump.txt

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -626,20 +626,26 @@ Options
626626

627627
.. option:: --oplog
628628

629-
Creates a file named :file:`oplog.bson` as part of the
630-
``mongodump`` output. The ``oplog.bson`` file, located in
631-
the top level of the output directory, contains oplog entries that
632-
occur during the ``mongodump`` operation. This file provides
633-
an effective point-in-time snapshot of the state of a
634-
``mongod`` instance. To restore to a specific point-in-time
635-
backup, use the output created with this option in conjunction with
636-
:option:`mongorestore --oplogReplay`.
629+
Creates a file named :file:`oplog.bson` as part of the ``mongodump``
630+
output. The ``oplog.bson`` file, located in the top level of the
631+
output directory, contains oplog entries that occur during the
632+
``mongodump`` operation.
637633

634+
To apply oplog entries from the ``oplog.bson`` file in the restore
635+
operation, use :option:`mongorestore --oplogReplay`. You can use
636+
``mongodump --oplog`` together with ``mongorestore --oplogReplay`` to
637+
ensure the data is current and has all the writes that occurred
638+
during the dump.
639+
638640
Without ``--oplog``, if there are write operations during the dump
639641
operation, the dump will not reflect a single moment in time. Changes
640642
made to the database during the update process can affect the output of
641643
the backup.
642-
644+
645+
To back up individual replica sets while still accepting writes, use
646+
``--oplog``. To back up sharded clusters with ``mongodump``, see
647+
:ref:`backup-sharded-dumps`.
648+
643649
.. important::
644650

645651
A ``mongodump`` running with ``--oplog`` fails if
@@ -650,11 +656,9 @@ Options
650656
- :method:`db.collection.renameCollection()`
651657
- :method:`db.collection.aggregate()` with :pipeline:`$out`
652658

653-
``--oplog`` has no effect when running ``mongodump``
654-
against a ``mongos`` instance to dump the entire contents of a
655-
sharded cluster. However, you can use ``--oplog`` to dump
656-
individual shards.
657-
659+
``--oplog`` has no effect when running ``mongodump`` on a ``mongos``
660+
instance to dump the entire contents of a sharded cluster.
661+
658662
``--oplog`` only works against nodes that maintain an
659663
:term:`oplog`. This includes all members of a replica set.
660664

@@ -731,6 +735,8 @@ For more information about ``mongodump``, see:
731735
- :ref:`mongodump-behavior`
732736
- :ref:`mongodump-examples`
733737

738+
For a tutorial, see :ref:`backup-sharded-dumps`.
739+
734740
.. include:: /includes/extracts/ssl-facts-see-more.rst
735741

736742
.. toctree::

source/mongorestore.txt

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,14 @@ Options
553553
.. option:: --oplogReplay
554554

555555
After restoring the database dump, replays the :term:`oplog` entries
556-
from a bson file.
557-
When used in conjunction with :option:`mongodump --oplog`,
558-
:binary:`mongorestore --oplogReplay <~bin.mongorestore>`
559-
restores the database to the point-in-time backup captured with the
560-
``mongodump --oplog`` command.
556+
from an ``oplog.bson`` file.
561557

558+
To apply oplog entries from the ``oplog.bson`` file in the restore,
559+
use ``mongorestore --oplogReplay``. You can use :option:`mongodump
560+
--oplog` together with ``mongorestore --oplogReplay`` to ensure the
561+
data is current and has all the writes that occurred during the dump
562+
operation.
563+
562564
``mongorestore`` searches for any valid source for the bson file
563565
in the following locations:
564566

@@ -625,7 +627,13 @@ Options
625627
``<time_t>`` is the seconds since the UNIX epoch, and ``<ordinal>``
626628
represents a counter of operations in the oplog that occurred in the
627629
specified second.
628-
630+
631+
.. warning::
632+
633+
Use ``oplogLimit`` with caution: manually specifying the oplog
634+
entries to apply might cause corruption and inconsistencies in the
635+
restored data.
636+
629637
You must use :option:`--oplogLimit` in conjunction with the
630638
:option:`--oplogReplay` option.
631639

@@ -639,7 +647,12 @@ Options
639647
file at the top level of the dump directory, ``mongorestore`` returns an
640648
error.
641649

650+
.. warning::
642651

652+
Use ``oplogFile`` with caution: manually specifying the oplog
653+
entries to apply might cause corruption and inconsistencies in the
654+
restored data.
655+
643656
.. option:: --convertLegacyIndexes
644657

645658
.. versionadded:: 100.0.0
@@ -859,6 +872,7 @@ Learn More
859872
- :ref:`mongorestore-compatibility-and-installation`
860873
- :ref:`Behavior <mongorestore-behavior-access-usage>`
861874
- :ref:`mongorestore-examples`
875+
- :ref:`backup-sharded-dumps`
862876

863877
.. toctree::
864878
:maxdepth: 1

source/mongorestore/mongorestore-examples.txt

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ To restore a specific collection, use :option:`--nsInclude
6060
<mongorestore --nsInclude>`, passing in the full namespace
6161
(``<database>.<collection>``) of the collection.
6262

63-
For example, the following restores the collection named
63+
The following example restores the collection named
6464
``purchaseorders`` in the database ``test`` from the corresponding
6565
files located in the ``dump/`` directory.
6666

@@ -331,14 +331,32 @@ namespace:
331331
You cannot restore the ``system.buckets.weather.bson`` file
332332
by itself. Attempting to do so results in an error.
333333

334+
Use mongorestore --oplogReplay and mongodump --oplog
335+
----------------------------------------------------
336+
337+
``mongodump`` creates a file named :file:`oplog.bson` as part of the
338+
``mongodump`` output. The ``oplog.bson`` file, located in the top level
339+
of the output directory, contains oplog entries that occur during the
340+
``mongodump`` operation.
341+
342+
To apply the oplog entries in the restore, use :option:`mongorestore
343+
--oplogReplay`. You can use :option:`mongodump --oplog` together with
344+
``mongorestore --oplogReplay`` to ensure the data is current and has all
345+
the writes that occurred during the dump operation. However, if any
346+
writes occur after ``mongodump`` completes, those writes aren't captured
347+
in that dump operation.
348+
349+
For more information, see :option:`mongodump --oplog`. For a tutorial,
350+
see :ref:`backup-sharded-dumps`.
351+
334352
.. _mongorestore-example-connect-using-aws-iam:
335353

336354
Connect to a MongoDB Atlas Cluster using AWS IAM Credentials
337355
------------------------------------------------------------
338356

339357
.. versionadded:: 100.1.0
340358

341-
To connect to a :atlas:`MongoDB Atlas <?tck=docs_server>` cluster which
359+
To connect to a :atlas:`MongoDB Atlas <?tck=docs_server>` cluster that
342360
has been configured to support authentication via `AWS IAM credentials
343361
<https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html>`__,
344362
provide a :option:`connection string <mongorestore --uri>` to
@@ -387,7 +405,7 @@ use the ``MONGODB-AWS``
387405
- ``AWS_SESSION_TOKEN``
388406

389407
If set, these credentials do not need to be specified in the connection
390-
string or via their explicit options.
408+
string or through their explicit options.
391409

392410
.. note::
393411

@@ -430,4 +448,6 @@ Learn More
430448

431449
- :ref:`mongorestore`
432450
- :ref:`mongorestore-compatibility-and-installation`
433-
- :ref:`Behavior <mongorestore-behavior-access-usage>`
451+
- :ref:`Behavior <mongorestore-behavior-access-usage>`
452+
- :ref:`manual-tutorial-backup-and-restore`
453+
- :ref:`backup-sharded-dumps`

0 commit comments

Comments
 (0)