@@ -9,58 +9,46 @@ Back Up and Restore with MongoDB Tools
9
9
.. contents:: On this page
10
10
:local:
11
11
:backlinks: none
12
- :depth: 1
12
+ :depth: 2
13
13
:class: singlecol
14
14
15
15
This 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.
17
18
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/>`.
19
23
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.
23
27
24
28
Considerations
25
29
--------------
26
30
31
+ .. _binary-bson-dumps:
32
+
27
33
Deployments
28
34
~~~~~~~~~~~
29
35
30
- The :binary:`~bin.mongodump ` and :binary:`~bin.mongorestore ` utilities
31
- work with :doc :`BSON </reference/ 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+} .
36
42
37
- .. note::
43
+ .. note:: Back Up Sharded Clusters with {+atlas+}
38
44
39
45
.. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
40
46
41
- Performance Considerations
42
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
47
+ Performance Impacts
48
+ ~~~~~~~~~~~~~~~~~~~
43
49
44
50
.. include:: /includes/extracts/tools-performance-considerations-dump-restore.rst
45
51
46
- .. _binary-bson-dumps:
47
-
48
- Binary BSON Dumps
49
- -----------------
50
-
51
- The :binary:`~bin.mongorestore` and :binary:`~bin.mongodump` utilities work with
52
- :doc:`BSON </reference/bson-types>` data dumps, and are useful for creating
53
- backups of small deployments. For resilient and non-disruptive backups, use a
54
- file system or block-level disk snapshot function, such as the methods
55
- described in the :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.
61
-
62
- .. include:: /includes/replacement-mms.rst
63
-
64
52
.. _backup-mongodump:
65
53
.. _backup-and-restore-tools:
66
54
@@ -70,7 +58,7 @@ Procedures
70
58
Back Up a Database with ``mongodump``
71
59
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72
60
73
- .. note::
61
+ .. note:: Back Up Sharded Clusters with {+atlas+}
74
62
75
63
.. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
76
64
@@ -106,13 +94,30 @@ use the following command:
106
94
107
95
mongodump
108
96
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:
97
+ To specify the host and port of the MongoDB instance, you can either:
112
98
113
- .. code-block:: bash
99
+ - Specify the hostname and port in the ``--uri`` string, using either an
100
+ :ref:`SRV <connections-dns-seedlist>` or
101
+ :ref:`standard <connections-standard-connection-string-format>` connection string:
102
+
103
+ .. code-block:: bash
104
+ :copyable: false
105
+
106
+ mongodump --uri="mongodb+srv://username:
[email protected] " <additional_options>
107
+
108
+ - Specify the hostname and port in the ``--host`` string:
109
+
110
+ .. code-block:: bash
111
+ :copyable: false
112
+
113
+ mongodump --host="mongodb0.example.com:27017" <additional_options>
114
+
115
+ - Specify the hostname and port in the ``--host`` and ``--port``:
114
116
115
- mongodump --host=mongodb.example.net --port=27017
117
+ .. code-block:: bash
118
+ :copyable: false
119
+
120
+ mongodump --host="mongodb0.example.com" --port=27017 <additional_options>
116
121
117
122
:binary:`~bin.mongodump` will write :term:`BSON` files that hold a copy of
118
123
data accessible via the :binary:`~bin.mongod` listening on port ``27017`` of
@@ -185,7 +190,7 @@ and password credentials to specify database authentication.
185
190
Restore a Database with ``mongorestore``
186
191
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187
192
188
- .. note::
193
+ .. note:: Back Up Sharded Clusters with {+atlas+}
189
194
190
195
.. include:: /includes/extracts/sharded-clusters-backup-restore-mongodump-mongorestore-restriction.rst
191
196
@@ -222,7 +227,7 @@ To use :binary:`~bin.mongorestore` to connect to an active
222
227
.. code-block:: bash
223
228
:copyable: false
224
229
225
- mongorestore --port=<port number > <path to the backup>
230
+ mongorestore --uri <connection string > <path to the backup>
226
231
227
232
228
233
Consider the following example:
0 commit comments