@@ -4,8 +4,6 @@ Back Up and Restore with MongoDB Tools
44
55.. default-domain:: mongodb
66
7-
8-
97.. contents:: On this page
108 :local:
119 :backlinks: none
@@ -134,7 +132,7 @@ or -o <mongodump.--out>` option:
134132
135133.. code-block:: bash
136134
137- mongodump --out=/data /backup/
135+ mongodump --out=/opt /backup/mongodump-1
138136
139137To limit the amount of data included in the database dump, you can
140138specify :option:`--db <mongodump.--db>` and
@@ -180,7 +178,12 @@ Consider the following example:
180178
181179.. code-block:: bash
182180
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
184187
185188On any :binary:`~bin.mongodump` command you may, as above, specify username
186189and password credentials to specify database authentication.
@@ -225,6 +228,7 @@ To use :binary:`~bin.mongorestore` to connect to an active
225228:binary:`~bin.mongod`, use a command with the following prototype form:
226229
227230.. code-block:: bash
231+ :copyable: false
228232
229233 mongorestore --port=<port number> <path to the backup>
230234
@@ -233,10 +237,10 @@ Consider the following example:
233237
234238.. code-block:: bash
235239
236- mongorestore dump-2013-10-25/
240+ mongorestore /opt/backup/mongodump-1
237241
238242Here, :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
240244running on the localhost interface on the default port ``27017``.
241245
242246.. _backup-restore-oplogreplay:
@@ -286,7 +290,10 @@ If restoring to an instance that enforces access control, include the
286290
287291.. code-block:: bash
288292
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
292299
0 commit comments