@@ -7,58 +7,46 @@ Back Up and Restore with MongoDB Tools
77.. contents:: On this page
88 :local:
99 :backlinks: none
10- :depth: 1
10+ :depth: 2
1111 :class: singlecol
1212
1313This tutorial describes the process for creating backups and restoring data
14- using the utilities provided with MongoDB.
14+ using the command-line utilities :binary:`~bin.mongorestore` and :binary:`~bin.mongodump`
15+ provided with MongoDB.
1516
16- .. note:: MongoDB Atlas
17+ To restore a backup of your self-hosted deployment
18+ to a managed `{+atlas+} deployment
19+ <https://www.mongodb.com/docs/atlas?tck=docs_server>`__,
20+ see :atlas:`Seed with mongorestore </import/mongorestore/>`.
1721
18- MongoDB Atlas uses :atlas:`Cloud Backups </backup/cloud-backup/overview>`,
19- which provide localized backup storage using the native snapshot
20- functionality of the cluster's cloud service provider.
22+ For a fully-managed backup method, use :atlas:`Cloud Backups </backup/cloud-backup/overview>`
23+ in MongoDB Atlas, which provide localized backup storage using the native snapshot
24+ functionality of the cluster's cloud service provider.
2125
2226Considerations
2327--------------
2428
29+ .. _binary-bson-dumps:
30+
2531Deployments
2632~~~~~~~~~~~
2733
28- The :binary:`~bin.mongodump ` and :binary:`~bin.mongorestore ` utilities
29- work with :doc :`BSON </reference/ bson-types>` data dumps, and are
30- useful for creating backups of small deployments. For resilient and
31- non-disruptive backups, use a file system or block-level disk snapshot
32- function, such as the methods described in the :doc:`/core/backups`
33- document .
34+ The :binary:`~bin.mongorestore ` and :binary:`~bin.mongodump ` utilities
35+ work with :ref :`BSON <bson-types>` data dumps, and are
36+ useful for creating backups of small deployments. For resilient and
37+ non-disruptive backups, use :doc:` file system snapshots </tutorial/backup-with-filesystem-snapshots>`
38+ or block-level disk snapshots with
39+ :atlas:`Cloud Backups </backup/cloud-backup/overview>` from {+atlas+} .
3440
35- .. note::
41+ .. note:: Back Up Sharded Clusters with {+atlas+}
3642
3743 .. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
3844
39- Performance Considerations
40- ~~~~~~~~~~~~~~~~~~~~~~~~~~
45+ Performance Impacts
46+ ~~~~~~~~~~~~~~~~~~~
4147
4248.. include:: /includes/extracts/tools-performance-considerations-dump-restore.rst
4349
44- .. _binary-bson-dumps:
45-
46- Binary BSON Dumps
47- -----------------
48-
49- The :binary:`~bin.mongorestore` and :binary:`~bin.mongodump` utilities work with
50- :doc:`BSON </reference/bson-types>` data dumps, and are useful for creating
51- backups of small deployments. For resilient and non-disruptive backups, use a
52- file system or block-level disk snapshot function, such as the methods
53- described in the :doc:`/core/backups` document.
54-
55- Use these tools for backups if other backup methods, such as
56- |mms-home| or
57- :doc:`file system snapshots </tutorial/backup-with-filesystem-snapshots>`
58- are unavailable.
59-
60- .. include:: /includes/replacement-mms.rst
61-
6250.. _backup-mongodump:
6351.. _backup-and-restore-tools:
6452
@@ -68,7 +56,7 @@ Procedures
6856Back Up a Database with ``mongodump``
6957~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7058
71- .. note::
59+ .. note:: Back Up Sharded Clusters with {+atlas+}
7260
7361 .. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
7462
@@ -104,13 +92,30 @@ use the following command:
10492
10593 mongodump
10694
107- You can also specify the :option:`--host <mongodump.--host>` and
108- :option:`--port <mongodump.--port>` of the MongoDB instance that the
109- :binary:`~bin.mongodump` should connect to. For example:
95+ To specify the host and port of the MongoDB instance, you can either:
11096
111- .. code-block:: bash
97+ - Specify the hostname and port in the ``--uri`` string, using either an
98+ :ref:`SRV <connections-dns-seedlist>` or
99+ :ref:`standard <connections-standard-connection-string-format>` connection string:
100+
101+ .. code-block:: bash
102+ :copyable: false
103+
104+ mongodump --uri="mongodb+srv://username:
[email protected] " <additional_options>
105+
106+ - Specify the hostname and port in the ``--host`` string:
107+
108+ .. code-block:: bash
109+ :copyable: false
110+
111+ mongodump --host="mongodb0.example.com:27017" <additional_options>
112+
113+ - Specify the hostname and port in the ``--host`` and ``--port``:
112114
113- mongodump --host=mongodb.example.net --port=27017
115+ .. code-block:: bash
116+ :copyable: false
117+
118+ mongodump --host="mongodb0.example.com" --port=27017 <additional_options>
114119
115120:binary:`~bin.mongodump` will write :term:`BSON` files that hold a copy of
116121data accessible via the :binary:`~bin.mongod` listening on port ``27017`` of
@@ -183,7 +188,7 @@ and password credentials to specify database authentication.
183188Restore a Database with ``mongorestore``
184189~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185190
186- .. note::
191+ .. note:: Back Up Sharded Clusters with {+atlas+}
187192
188193 .. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
189194
@@ -220,7 +225,7 @@ To use :binary:`~bin.mongorestore` to connect to an active
220225.. code-block:: bash
221226 :copyable: false
222227
223- mongorestore --port=<port number > <path to the backup>
228+ mongorestore --uri <connection string > <path to the backup>
224229
225230
226231Consider the following example:
0 commit comments