@@ -9,57 +9,47 @@ Back Up and Restore with MongoDB Tools
99.. contents:: On this page
1010 :local:
1111 :backlinks: none
12- :depth: 1
12+ :depth: 2
1313 :class: singlecol
1414
1515This tutorial describes the process for creating backups and restoring data
16- using the utilities provided with MongoDB.
16+ using the command-line utilities :binary:`~bin.mongorestore` and :binary:`~bin.mongodump`
17+ provided with MongoDB.
1718
18- .. note:: MongoDB Atlas
19+ To restore a backup of your self-hosted deployment
20+ to a managed `{+atlas+} deployment
21+ <https://www.mongodb.com/docs/atlas?tck=docs_server>`__,
22+ see :atlas:`Seed with mongorestore </import/mongorestore/>`.
1923
20- MongoDB Atlas uses :atlas:`Cloud Backups </backup/cloud-backup/overview>`,
21- which provide localized backup storage using the native snapshot
22- functionality of the cluster's cloud service provider.
24+ For a fully-managed backup method, use :atlas:`Cloud Backups </backup/cloud-backup/overview>`
25+ in MongoDB Atlas, which provide localized backup storage using the native snapshot
26+ functionality of the cluster's cloud service provider.
2327
2428Considerations
2529--------------
2630
31+ .. _binary-bson-dumps:
32+
2733Deployments
2834~~~~~~~~~~~
2935
30- The :binary:`~bin.mongodump ` and :binary:`~bin.mongorestore ` utilities
31- work with :ref:`BSON <bson-types>` data dumps, and are
32- useful for creating backups of small deployments. For resilient and
33- non-disruptive backups, use a file system or block-level disk snapshot
34- function, such as the methods described in the :doc:`/core/backups`
35- document .
36+ The :binary:`~bin.mongorestore ` and :binary:`~bin.mongodump ` utilities
37+ work with :ref:`BSON <bson-types>` data dumps, and are
38+ useful for creating backups of small deployments. For resilient and
39+ non-disruptive backups, use :doc:` file system snapshots </tutorial/backup-with-filesystem-snapshots>`
40+ or block-level disk snapshots with
41+ :atlas:`Cloud Backups </backup/cloud-backup/overview>` from {+atlas+} .
3642
37- .. note::
43+ .. note:: Back Up Sharded Clusters with {+atlas+}
3844
3945 .. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
4046
41- Performance Considerations
42- ~~~~~~~~~~~~~~~~~~~~~~~~~~
47+ Performance Impacts
48+ ~~~~~~~~~~~~~~~~~~~
4349
4450.. include:: /includes/extracts/tools-performance-considerations-dump-restore.rst
4551
46- .. _binary-bson-dumps:
47-
48- Binary BSON Dumps
49- -----------------
50-
51- The :binary:`~bin.mongorestore` and :binary:`~bin.mongodump` utilities work with
52- BSON data dumps, and are useful for creating backups of small deployments.
53- For resilient and non-disruptive backups, use a file system or
54- block-level disk snapshot function, such as the methods described in the
55- :doc:`/core/backups` document.
56-
57- Use these tools for backups if other backup methods, such as
58- |mms-home| or
59- :doc:`file system snapshots </tutorial/backup-with-filesystem-snapshots>`
60- are unavailable.
6152
62- .. include:: /includes/replacement-mms.rst
6353
6454.. _backup-mongodump:
6555.. _backup-and-restore-tools:
@@ -70,7 +60,7 @@ Procedures
7060Back Up a Database with ``mongodump``
7161~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7262
73- .. note::
63+ .. note:: Back Up Sharded Clusters with {+atlas+}
7464
7565 .. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
7666
@@ -106,13 +96,30 @@ use the following command:
10696
10797 mongodump
10898
109- You can also specify the :option:`--host <mongodump.--host>` and
110- :option:`--port <mongodump.--port>` of the MongoDB instance that the
111- :binary:`~bin.mongodump` should connect to. For example:
99+ To specify the host and port of the MongoDB instance, you can either:
112100
113- .. code-block:: bash
101+ - Specify the hostname and port in the ``--uri`` string, using either an
102+ :ref:`SRV <connections-dns-seedlist>` or
103+ :ref:`standard <connections-standard-connection-string-format>` connection string:
104+
105+ .. code-block:: bash
106+ :copyable: false
107+
108+ mongodump --uri="mongodb+srv://username:
[email protected] " <additional_options>
109+
110+ - Specify the hostname and port in the ``--host`` string:
111+
112+ .. code-block:: bash
113+ :copyable: false
114+
115+ mongodump --host="mongodb0.example.com:27017" <additional_options>
116+
117+ - Specify the hostname and port in the ``--host`` and ``--port``:
114118
115- mongodump --host=mongodb.example.net --port=27017
119+ .. code-block:: bash
120+ :copyable: false
121+
122+ mongodump --host="mongodb0.example.com" --port=27017 <additional_options>
116123
117124:binary:`~bin.mongodump` will write :term:`BSON` files that hold a copy of
118125data accessible via the :binary:`~bin.mongod` listening on port ``27017`` of
@@ -185,7 +192,7 @@ and password credentials to specify database authentication.
185192Restore a Database with ``mongorestore``
186193~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187194
188- .. note::
195+ .. note:: Back Up Sharded Clusters with {+atlas+}
189196
190197 .. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
191198
@@ -222,7 +229,7 @@ To use :binary:`~bin.mongorestore` to connect to an active
222229.. code-block:: bash
223230 :copyable: false
224231
225- mongorestore --port=<port number > <path to the backup>
232+ mongorestore --uri <connection string > <path to the backup>
226233
227234
228235Consider the following example:
0 commit comments