@@ -5,57 +5,57 @@ Backup and Restoration Strategies
5
5
.. default-domain:: mongodb
6
6
7
7
This document provides an inventory of database backup strategies for
8
- use with MongoDB. Use the ":ref:`backup overview <backup-overview>`"
9
- and ":ref:`backup considerations <backup-considerations>`" sections as
10
- you develop the most appropriate strategy for backing up your MongoDB
11
- environment. Then, use the examples from the ":ref:`block level backup
12
- methods <block-level-backup>`" or the ":ref:`backups using mongodump
13
- <database-dumps>`" sections to implement the backup solution that is
14
- best suited to your deployment's needs.
15
-
16
- A robust backup strategy and a well-tested corresponding restoration
17
- process is crucial for every production-grade deployment. Take the
18
- specific features of your deployment, your use patterns, and
19
- architecture into consideration as you develop your own backup system.
20
-
21
- :term:`Replica sets <replica set>` and :term:`sharded clusters
22
- <sharded cluster>` require special considerations. See
23
- :ref:`backup considerations for sharded clusters and replica sets
24
- <backups-with-sharding-and-replication>`.
8
+ use with MongoDB.
9
+
10
+ - The :ref:`backup-overview` and :ref:`backup-considerations` sections
11
+ describe the approaches for backing up your MongoDB environment.
12
+
13
+ - The :ref:`block-level-backup` or :ref:`database-dumps` sections
14
+ describe specific strategies.
15
+
16
+ - The :ref:`backups-with-sharding-and-replication` section describes
17
+ considerations specific to :term:`replica sets <replica set>` and
18
+ :term:`sharded clusters <sharded cluster>`.
25
19
26
20
.. _backup-overview:
27
21
28
- Overview
29
- --------
22
+ Backup Overview
23
+ ---------------
30
24
31
- If you are familiar with backups systems in the context of database
32
- systems please skip ahead to :ref:`backup considerations <backup-considerations>`.
25
+ A robust backup strategy and well tested restoration process are crucial
26
+ for production-grade deployments. The goal of a backup strategy is to
27
+ produce a full and consistent copy of the data that you can use to bring
28
+ up a new or replacement database instance.
33
29
34
30
With MongoDB, there are two major approaches to backups:
35
- using system-level tools, like disk image snapshots, and using various
36
- capacities present in the :ref:`mongodump tool <database-dumps>`.
37
- The underlying goal of these strategies is to produce a full and consistent
38
- copy of the data that you can use to bring up a new or replacement
39
- database instance.
40
-
41
- The methods described in this document operate by copying the data
42
- file on the disk level. If your system does not provide functionality
43
- for this kind of backup, see the section on :ref:`using database dumps
44
- for backups <database-dumps>` for more information.
45
-
46
- Ensuring that the state captured by the backup is consistent and
47
- usable is the primary challenge of producing backups of database
48
- systems. Backups that you cannot produce reliably, or restore from
49
- feasibly are worthless.
50
-
51
- Because every environment is unique it's important to regularly test
52
- the backups that you capture to ensure that your backup system is
31
+
32
+ - Using system-level tools, like disk image snapshots. See
33
+ :ref:`block-level-backup`.
34
+
35
+ - Using various capacities present in the :program:`mongodump` tool. See
36
+ :ref:`database-dumps`.
37
+
38
+ The methods described in this document operate by copying the data file
39
+ on the disk level. If your system does not provide functionality for
40
+ this kind of backup, see the section on :ref:`using database dumps for
41
+ backups <database-dumps>` for more information.
42
+
43
+ Ensuring that the state captured by the backup is consistent and usable
44
+ is the primary challenge of producing backups of database systems.
45
+ Backups that you cannot produce reliably, or restore from feasibly are
46
+ worthless.
47
+
48
+ As you develop your backup system, take into consideration the specific
49
+ features of your deployment, your use patterns, and your architecture.
50
+
51
+ Because every environment is unique it's important to regularly test the
52
+ backups that you capture to ensure that your backup system is
53
53
practically, and not just theoretically, functional.
54
54
55
55
.. _backup-considerations:
56
56
57
- Production Considerations
58
- -------------------------
57
+ Production Considerations for Backup Strategies
58
+ -----------------------------------------------
59
59
60
60
When evaluating a backup strategy for your node consider the following
61
61
factors:
@@ -97,23 +97,23 @@ for your database. Remember that all backup plans must be:
97
97
98
98
.. _block-level-backup:
99
99
100
- Block Level Methods
101
- -------------------
100
+ Using Block Level Backup Methods
101
+ --------------------------------
102
102
103
- This section will provides an overview of using disk/block level
103
+ This section provides an overview of using disk/block level
104
104
snapshots (i.e. :term:`LVM` or storage appliance) to backup a MongoDB
105
105
instance. These tools make a quick block-level backup of the device
106
106
that holds MongoDB's data files. These methods complete quickly, work
107
107
reliably, and typically provide the easiest backup systems method to
108
108
implement.
109
109
110
110
Snapshots work by creating pointers between the live data and a
111
- special snapshot volume: these pointers are theoretically equivalent
112
- to "hard links." Then, as the working data diverges from the snapshot,
111
+ special snapshot volume. These pointers are theoretically equivalent
112
+ to "hard links." As the working data diverges from the snapshot,
113
113
the snapshot process uses a copy-on-write strategy. As a result the snapshot
114
114
only stores modified data.
115
115
116
- After making the snapshot, you will mount the snapshot image on your
116
+ After making the snapshot, you mount the snapshot image on your
117
117
file system and copy data from the snapshot. The resulting backup
118
118
contains a full copy of all data.
119
119
@@ -129,8 +129,8 @@ Snapshots have the following limitations:
129
129
backup occurs, the data files will reflect an inconsistent
130
130
state. With :term:`journaling <journal>` all data-file states
131
131
resulting from in-progress writes are recoverable; without
132
- journaling you must flush all pending writes and to disk before
133
- running the backup operation and ensure that no writes occur during
132
+ journaling you must flush all pending writes to disk before
133
+ running the backup operation and must ensure that no writes occur during
134
134
the entire backup procedure.
135
135
136
136
If you do use journaling, the journal must reside on the same volume
@@ -153,7 +153,7 @@ With Journaling
153
153
~~~~~~~~~~~~~~~
154
154
155
155
If your system has snapshot capability and your :program:`mongod` instance
156
- has journaling enabled then you can use any kind of file system or
156
+ has journaling enabled, then you can use any kind of file system or
157
157
volume/block level snapshot tool to create backups.
158
158
159
159
.. warning::
@@ -182,7 +182,7 @@ LVM-based setups *within* a cloud/virtualized environment.
182
182
If you use Amazon's EBS service in a software RAID 10 (e.g. 1+0)
183
183
configuration, use :term:`LVM` to capture a consistent disk image.
184
184
185
- Also consider, :ref:`backup-amazon-software-raid`
185
+ Also consider, :ref:`backup-amazon-software-raid`.
186
186
187
187
The following sections provide an overview of a simple backup process
188
188
using :term:`LVM` on a Linux system. While the tools, commands, and paths may
@@ -194,7 +194,7 @@ high level overview of the backup operation.
194
194
Create Snapshot
195
195
```````````````
196
196
197
- To create a snapshot with :term:`LVM` issue a command, as root, in the
197
+ To create a snapshot with :term:`LVM`, issue a command, as root, in the
198
198
following format:
199
199
200
200
.. code-block:: sh
@@ -239,7 +239,7 @@ Archive Snapshots
239
239
`````````````````
240
240
241
241
After creating a snapshot, mount the snapshot and move the data to
242
- separate storage. Your system may wish to compress the backup images as
242
+ separate storage. Your system might try to compress the backup images as
243
243
you move the offline. Consider the following procedure to fully
244
244
archive the data from the snapshot:
245
245
@@ -248,19 +248,19 @@ archive the data from the snapshot:
248
248
umount /dev/vg0/mdb-snap01
249
249
dd if=/dev/vg0/mdb-snap01 | tar -czf mdb-snap01.tar.gz
250
250
251
- This command sequence:
251
+ The above command sequence:
252
252
253
- 1. Ensures that the ``/dev/vg0/mdb-snap01`` device is not mounted.
253
+ - Ensures that the ``/dev/vg0/mdb-snap01`` device is not mounted.
254
254
255
- 2. Does a block level copy of the entire snapshot image using the
256
- ``dd`` command, and compresses the result in a gziped tar archive
257
- in the current working directory.
255
+ - Does a block level copy of the entire snapshot image using the ``dd``
256
+ command, and compresses the result in a gziped tar archive in the
257
+ current working directory.
258
258
259
- .. warning::
259
+ .. warning::
260
260
261
- This command will create a large ``tar.gz`` file in your current
262
- working directory. Make sure that you run this command in a
263
- file system that has enough free space.
261
+ This command will create a large ``tar.gz`` file in your current
262
+ working directory. Make sure that you run this command in a file
263
+ system that has enough free space.
264
264
265
265
Restore Snapshot
266
266
````````````````
@@ -274,34 +274,33 @@ procedure:
274
274
tar -xzf mdb-snap01.tar.gz | dd of=/dev/vg0/mdb-new
275
275
mount /dev/vg0/mdb-new /srv/mongodb
276
276
277
- This sequence:
277
+ The above sequence:
278
278
279
- 1. Creates a new logical volume named ``mdb-new``, in the
280
- ``/dev/vg0`` volume group. The path to the new device will be
281
- ``/dev/vg0/mdb-new``.
279
+ - Creates a new logical volume named ``mdb-new``, in the ``/dev/vg0``
280
+ volume group. The path to the new device will be ``/dev/vg0/mdb-new``.
282
281
283
- .. warning::
282
+ .. warning::
284
283
285
- This volume will have a maximum size of 1 gigabyte. The original
286
- file system must have had a total size of 1 gigabyte or smaller,
287
- or else the restoration will fail.
284
+ This volume will have a maximum size of 1 gigabyte. The original
285
+ file system must have had a total size of 1 gigabyte or smaller, or
286
+ else the restoration will fail.
288
287
289
- Change ``1G`` to your desired volume size.
288
+ Change ``1G`` to your desired volume size.
290
289
291
- 2. Uncompresses and unarchives the ``mdb-snap01.tar.gz`` into the
292
- ``mdb-new`` disk image.
290
+ - Uncompresses and unarchives the ``mdb-snap01.tar.gz`` into the
291
+ ``mdb-new`` disk image.
293
292
294
- 3. Mounts the ``mdb-new`` disk image to the ``/srv/mongodb``
295
- directory. Modify the mount point to correspond to your MongoDB
296
- data file location, or other location as needed.
293
+ - Mounts the ``mdb-new`` disk image to the ``/srv/mongodb`` directory.
294
+ Modify the mount point to correspond to your MongoDB data file
295
+ location, or other location as needed.
297
296
298
297
.. _backup-restore-from-snapshot:
299
298
300
299
Restore Directly from a Snapshot
301
300
````````````````````````````````
302
301
303
- To combine the above processes without writing to a compressed ``tar``
304
- archive, use the following sequence:
302
+ To restore a backup without writing to a compressed ``tar`` archive, use
303
+ the following sequence:
305
304
306
305
.. code-block:: sh
307
306
@@ -395,11 +394,11 @@ tool. As a result you may:
395
394
396
395
.. _database-dumps:
397
396
398
- Binary Dump/Restore Formats
399
- ----------------------------
397
+ Using Binary Database Dumps for Backups
398
+ ---------------------------------------
400
399
401
400
This section describes the process for writing the entire contents of
402
- your MongoDB instance, to a file in a binary format. This command
401
+ your MongoDB instance to a file in a binary format. This command
403
402
provides the best option for full system database backups if
404
403
disk-level snapshots are not available.
405
404
0 commit comments