Skip to content

Commit d6acea5

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-39420-additional-example-details (#156)
* DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details * DOCSP-39420-additional-example-details --------- Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 4fdf97d commit d6acea5

File tree

4 files changed

+52
-18
lines changed

4 files changed

+52
-18
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
To create a consistent ``mongodump`` backup file using :term:`oplog`
2+
entries, use the :option:`mongodump --oplog` option. To restore data
3+
from the backup file, use the :option:`mongorestore --oplogReplay`
4+
option.
5+
6+
The :term:`oplog` contains the history of database write operations.
7+
8+
``mongodump`` outputs:
9+
10+
- Collection documents, metadata, and options.
11+
- Index definitions.
12+
- Writes that occur during the ``mongodump`` run, if ``--oplog`` is
13+
specified.
14+
15+
Use mongodump with oplog Option
16+
```````````````````````````````
17+
18+
``mongodump --oplog`` creates a file named :file:`oplog.bson` in the top
19+
level of the ``mongodump`` output directory. The file contains write
20+
operations that occur during the ``mongodump`` run. Writes that occur
21+
after ``mongodump`` completes aren't recorded in the file.
22+
23+
To back up sharded clusters with ``mongodump``, see
24+
:ref:`backup-sharded-dumps`.
25+
26+
Use mongorestore with oplogReplay Option
27+
````````````````````````````````````````
28+
29+
To restore oplog entries from the ``oplog.bson`` file, use
30+
``mongorestore --oplogReplay``. Use ``mongodump --oplog`` together with
31+
``mongorestore --oplogReplay`` to ensure the database is current and has
32+
all writes that occurred during the ``mongodump`` run.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- `mongosync utility
2+
<https://www.mongodb.com/docs/cluster-to-cluster-sync/current/reference/mongosync>`__
3+
for cluster to cluster migrations
4+
- :atlas:`Migrate or import data </import>` in Atlas
5+
- :atlas:`Back up, restore, and archive data </backup-restore-cluster>`
6+
in Atlas

source/mongodump/mongodump-examples.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,16 @@ In this example:
227227

228228
mongodump 'mongodb+srv://myuser:[email protected]/?authSource=admin' --db testdb
229229

230+
Create and Restore Consistent Backup Files
231+
------------------------------------------
232+
233+
.. include:: /includes/mongodump-mongorestore-consistent-data.rst
234+
230235
Learn More
231236
----------
232237

233238
- :ref:`mongodump`
234239
- :ref:`mongodump-compatibility-and-installation`
235240
- :ref:`mongodump-behavior`
241+
242+
.. include:: /includes/mongodump-mongorestore-learn-more.rst

source/mongorestore/mongorestore-examples.txt

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -331,24 +331,6 @@ 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-
352334
.. _mongorestore-example-connect-using-aws-iam:
353335

354336
Connect to a MongoDB Atlas Cluster using AWS IAM Credentials
@@ -443,6 +425,11 @@ using these environment variables:
443425

444426
mongorestore 'mongodb+srv://cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS' <other options>
445427

428+
Create and Restore Consistent Backup Files
429+
------------------------------------------
430+
431+
.. include:: /includes/mongodump-mongorestore-consistent-data.rst
432+
446433
Learn More
447434
----------
448435

@@ -451,3 +438,5 @@ Learn More
451438
- :ref:`Behavior <mongorestore-behavior-access-usage>`
452439
- :ref:`manual-tutorial-backup-and-restore`
453440
- :ref:`backup-sharded-dumps`
441+
442+
.. include:: /includes/mongodump-mongorestore-learn-more.rst

0 commit comments

Comments
 (0)