@@ -4,8 +4,6 @@ Back Up and Restore with MongoDB Tools
4
4
5
5
.. default-domain:: mongodb
6
6
7
-
8
-
9
7
.. contents:: On this page
10
8
:local:
11
9
:backlinks: none
@@ -134,7 +132,7 @@ or -o <mongodump.--out>` option:
134
132
135
133
.. code-block:: bash
136
134
137
- mongodump --out=/data /backup/
135
+ mongodump --out=/opt /backup/mongodump-1
138
136
139
137
To limit the amount of data included in the database dump, you can
140
138
specify :option:`--db <mongodump.--db>` and
@@ -180,7 +178,12 @@ Consider the following example:
180
178
181
179
.. code-block:: bash
182
180
183
- mongodump --host=mongodb1.example.net --port=3017 --username=user --password="pass" --out=/opt/backup/mongodump-2013-10-24
181
+ mongodump \
182
+ --host=mongodb1.example.net \
183
+ --port=3017 \
184
+ --username=user \
185
+ --password="pass" \
186
+ --out=/opt/backup/mongodump-1
184
187
185
188
On any :binary:`~bin.mongodump` command you may, as above, specify username
186
189
and password credentials to specify database authentication.
@@ -225,6 +228,7 @@ To use :binary:`~bin.mongorestore` to connect to an active
225
228
:binary:`~bin.mongod`, use a command with the following prototype form:
226
229
227
230
.. code-block:: bash
231
+ :copyable: false
228
232
229
233
mongorestore --port=<port number> <path to the backup>
230
234
@@ -233,10 +237,10 @@ Consider the following example:
233
237
234
238
.. code-block:: bash
235
239
236
- mongorestore dump-2013-10-25/
240
+ mongorestore /opt/backup/mongodump-1
237
241
238
242
Here, :binary:`~bin.mongorestore` imports the database backup in
239
- the :file:`dump-2013-10-25 ` directory to the :binary:`~bin.mongod` instance
243
+ the :file:`/opt/backup/mongodump-1 ` directory to the :binary:`~bin.mongod` instance
240
244
running on the localhost interface on the default port ``27017``.
241
245
242
246
.. _backup-restore-oplogreplay:
@@ -286,7 +290,10 @@ If restoring to an instance that enforces access control, include the
286
290
287
291
.. code-block:: bash
288
292
289
- mongorestore --host=mongodb1.example.net --port=3017 --username=user --authenticationDatabase=admin /opt/backup/mongodump-2013-10-24
290
-
291
-
293
+ mongorestore \
294
+ --host=mongodb1.example.net \
295
+ --port=3017 \
296
+ --username=user \
297
+ --authenticationDatabase=admin \
298
+ /opt/backup/mongodump-1
292
299
0 commit comments