@@ -4,13 +4,26 @@ Backup Databases Using Block Level Backup Methods
4
4
5
5
.. default-domain:: mongodb
6
6
7
- This section provides an overview of using disk/block level
8
- snapshots (i.e. :term:`LVM` or storage appliance) to backup a MongoDB
9
- instance. These tools make a quick block-level backup of the device
7
+ This section describes how to backup and restore a MongoDB instance
8
+ using system-level tools (such as :term:`LVM` or storage appliance) that
9
+ create block-level snapshots of the device
10
10
that holds MongoDB's data files. These methods complete quickly, work
11
11
reliably, and typically provide the easiest backup systems method to
12
12
implement.
13
13
14
+ This page describes the following:
15
+
16
+ - :ref:`snapshots-overview`
17
+
18
+ - :ref:`lvm-backup-and-restore`
19
+
20
+ - :ref:`backup-without-journaling`
21
+
22
+ .. _snapshots-overview:
23
+
24
+ Snapshots Overview
25
+ ------------------
26
+
14
27
Snapshots work by creating pointers between the live data and a
15
28
special snapshot volume. These pointers are theoretically equivalent
16
29
to "hard links." As the working data diverges from the snapshot,
@@ -53,51 +66,58 @@ Snapshots have the following limitations:
53
66
54
67
.. _backup-with-journaling:
55
68
56
- Backup With Journaling
57
- ----------------------
69
+ Snapshots With Journaling
70
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
58
71
59
- If your system has snapshot capability and your :program:`mongod` instance
60
- has journaling enabled, then you can use any kind of file system or
61
- volume/block level snapshot tool to create backups.
72
+ If your :program:`mongod` instance has journaling enabled, then you can
73
+ use any kind of file system or volume/block level snapshot tool to
74
+ create backups.
62
75
63
- .. warning::
76
+ If you manage your own infrastructure on a Linux-based system, configure
77
+ your system with :term:`LVM` to provide your disk packages and provide
78
+ snapshot capability. You can also use LVM-based setups *within* a
79
+ cloud/virtualized environment.
64
80
65
- .. versionchanged:: 1.9.2
81
+ .. note::
66
82
67
- Journaling is only enabled by default on 64-bit builds of
68
- MongoDB.
83
+ Running :term:`LVM` provides additional flexibility and enables the
84
+ possibility of using snapshots to back up MongoDB.
69
85
70
- To enable journaling on all other builds, specify
71
- :setting:`journal` = ``true`` in the configuration or use the
72
- :option:`--journal <mongod --journal>` run-time option for
73
- :program:`mongod`.
86
+ Snapshots with Amazon EBS in a RAID 10 Configuration
87
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74
88
75
- Many service providers provide a block-level backup service based on
76
- disk image snapshots. If you manage your own infrastructure on a
77
- Linux-based system, configure your system with :term:`LVM` to provide
78
- your disk packages and provide snapshot capability. You can also use
79
- LVM-based setups *within* a cloud/virtualized environment.
89
+ If your deployment depends on Amazon’s Elastic Block Storage (EBS) with
90
+ RAID configured within your instance, it is impossible to get a
91
+ consistent state across all disks using the platform’s snapshot tool. As
92
+ an alternative, you can do one of the following:
80
93
81
- .. note::
94
+ - Flush all writes to disk and create a write lock to ensure
95
+ consistent state during the backup process.
82
96
83
- Running :term:`LVM` provides additional flexibility and enables the
84
- possibility of using snapshots to back up MongoDB.
97
+ If you choose this option see :ref:`backup-without-journaling`.
85
98
86
- If you use Amazon's EBS service in a software RAID 10 configuration, use
87
- :term:`LVM` to capture a consistent disk image. Also, see the special
88
- considerations described in :ref:`backup-amazon-software-raid`.
99
+ - Configure :term:`LVM` to run and hold your MongoDB data files on top of the
100
+ RAID within your system.
89
101
90
- The following sections provide an overview of a simple backup process
102
+ If you choose this option, perform the LVM backup operation described
103
+ in :ref:`lvm-backup-operation`.
104
+
105
+ .. _lvm-backup-and-restore:
106
+
107
+ Backup and Restore Using LVM on a Linux System
108
+ ----------------------------------------------
109
+
110
+ This section provides an overview of a simple backup process
91
111
using :term:`LVM` on a Linux system. While the tools, commands, and paths may
92
112
be (slightly) different on your system the following steps provide a
93
113
high level overview of the backup operation.
94
114
95
115
.. _lvm-backup-operation:
96
116
97
- Create Snapshot
98
- ~~~~~~~~~~~~~~~
117
+ Create a Snapshot
118
+ ~~~~~~~~~~~~~~~~~
99
119
100
- To create a snapshot with :term:`LVM`, issue a command, as root, in the
120
+ To create a snapshot with :term:`LVM`, issue a command as root in the
101
121
following format:
102
122
103
123
.. code-block:: sh
@@ -138,25 +158,25 @@ data. Snapshots typically depend and reside on the same storage
138
158
infrastructure as the original disk images. Therefore, it's crucial
139
159
that you archive these snapshots and store them elsewhere.
140
160
141
- Archive Snapshots
142
- ~~~~~~~~~~~~~~~~~
161
+ Archive a Snapshot
162
+ ~~~~~~~~~~~~~~~~~~
143
163
144
164
After creating a snapshot, mount the snapshot and move the data to
145
165
separate storage. Your system might try to compress the backup images as
146
- you move the offline. Consider the following procedure to fully
147
- archive the data from the snapshot:
166
+ you move the offline. The following procedure fully
167
+ archives the data from the snapshot:
148
168
149
169
.. code-block:: sh
150
170
151
171
umount /dev/vg0/mdb-snap01
152
172
dd if=/dev/vg0/mdb-snap01 | tar -czf mdb-snap01.tar.gz -
153
173
154
- The above command sequence:
174
+ The above command sequence does the following :
155
175
156
176
- Ensures that the ``/dev/vg0/mdb-snap01`` device is not mounted.
157
177
158
- - Does a block level copy of the entire snapshot image using the ``dd``
159
- command, and compresses the result in a gzipped tar archive in the
178
+ - Performs a block level copy of the entire snapshot image using the ``dd``
179
+ command and compresses the result in a gzipped tar archive in the
160
180
current working directory.
161
181
162
182
.. warning::
@@ -167,19 +187,19 @@ The above command sequence:
167
187
168
188
.. _backup-restore-snapshot:
169
189
170
- Restore Snapshot
171
- ~~~~~~~~~~~~~~~~
190
+ Restore a Snapshot
191
+ ~~~~~~~~~~~~~~~~~~
172
192
173
- To restore a backup created with the above method, use the following
174
- procedure :
193
+ To restore a snapshot created with the above method, issue the following
194
+ sequence of commands :
175
195
176
196
.. code-block:: sh
177
197
178
198
lvcreate --size 1G --name mdb-new vg0
179
199
tar -xzf mdb-snap01.tar.gz | dd of=/dev/vg0/mdb-new
180
200
mount /dev/vg0/mdb-new /srv/mongodb
181
201
182
- The above sequence:
202
+ The above sequence does the following :
183
203
184
204
- Creates a new logical volume named ``mdb-new``, in the ``/dev/vg0``
185
205
volume group. The path to the new device will be ``/dev/vg0/mdb-new``.
@@ -205,7 +225,7 @@ Restore Directly from a Snapshot
205
225
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
206
226
207
227
To restore a backup without writing to a compressed ``tar`` archive, use
208
- the following sequence:
228
+ the following sequence of commands :
209
229
210
230
.. code-block:: sh
211
231
@@ -235,8 +255,8 @@ Consider the following procedure:
235
255
236
256
.. _backup-without-journaling:
237
257
238
- Backup Without Journaling
239
- -------------------------
258
+ Create Backups on Instances that do not Run Journaling
259
+ ------------------------------------------------------
240
260
241
261
If your :program:`mongod` instance does not run with journaling
242
262
enabled, or if your journal is on a separate volume, obtaining a
@@ -281,24 +301,3 @@ member`).
281
301
.. include:: /includes/note-disable-profiling-fsynclock.rst
282
302
283
303
.. include:: /includes/warning-fsync-lock-mongodump.rst
284
-
285
- .. _backup-amazon-software-raid:
286
-
287
- Amazon EBS in Software RAID 10 Configuration
288
- --------------------------------------------
289
-
290
- If your deployment depends on Amazon's Elastic Block Storage (EBS)
291
- with RAID configured *within* your instance, it is impossible to get a
292
- consistent state across all disks using the platform's snapshot
293
- tool. As a result you may:
294
-
295
- - Flush all writes to disk and create a write lock to ensure
296
- consistent state during the backup process.
297
-
298
- If you choose this option see :ref:`backup-without-journaling`.
299
-
300
- - Configure LVM to run and hold your MongoDB data files on top of the
301
- RAID within your system.
302
-
303
- If you choose this option, perform the LVM backup operation described
304
- in :ref:`lvm-backup-operation`.
0 commit comments