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