@@ -7,58 +7,46 @@ Back Up and Restore with MongoDB Tools
7
7
.. contents:: On this page
8
8
:local:
9
9
:backlinks: none
10
- :depth: 1
10
+ :depth: 2
11
11
:class: singlecol
12
12
13
13
This 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.
15
16
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/>`.
17
21
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.
21
25
22
26
Considerations
23
27
--------------
24
28
29
+ .. _binary-bson-dumps:
30
+
25
31
Deployments
26
32
~~~~~~~~~~~
27
33
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+} .
34
40
35
- .. note::
41
+ .. note:: Back Up Sharded Clusters with {+atlas+}
36
42
37
43
.. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
38
44
39
- Performance Considerations
40
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
45
+ Performance Impacts
46
+ ~~~~~~~~~~~~~~~~~~~
41
47
42
48
.. include:: /includes/extracts/tools-performance-considerations-dump-restore.rst
43
49
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
-
62
50
.. _backup-mongodump:
63
51
.. _backup-and-restore-tools:
64
52
@@ -68,7 +56,7 @@ Procedures
68
56
Back Up a Database with ``mongodump``
69
57
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70
58
71
- .. note::
59
+ .. note:: Back Up Sharded Clusters with {+atlas+}
72
60
73
61
.. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
74
62
@@ -104,13 +92,30 @@ use the following command:
104
92
105
93
mongodump
106
94
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:
110
96
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``:
112
114
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>
114
119
115
120
:binary:`~bin.mongodump` will write :term:`BSON` files that hold a copy of
116
121
data accessible via the :binary:`~bin.mongod` listening on port ``27017`` of
@@ -183,7 +188,7 @@ and password credentials to specify database authentication.
183
188
Restore a Database with ``mongorestore``
184
189
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185
190
186
- .. note::
191
+ .. note:: Back Up Sharded Clusters with {+atlas+}
187
192
188
193
.. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
189
194
@@ -220,7 +225,7 @@ To use :binary:`~bin.mongorestore` to connect to an active
220
225
.. code-block:: bash
221
226
:copyable: false
222
227
223
- mongorestore --port=<port number > <path to the backup>
228
+ mongorestore --uri <connection string > <path to the backup>
224
229
225
230
226
231
Consider the following example:
0 commit comments