Skip to content

Commit d30713c

Browse files
committed
DOCS-137. first half of backup/restore.
1 parent 28c549a commit d30713c

File tree

1 file changed

+54
-33
lines changed

1 file changed

+54
-33
lines changed

source/administration/backups.rst

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Backup and Restoration Strategies
33
=================================
44

5+
TODO: consistent use of LVM, lvm and where it's linked or not needs to
6+
be addressed.
7+
58
.. default-domain:: mongodb
69

710
This document provides an inventory of database backup strategies for
@@ -13,6 +16,9 @@ use the examples from the :ref:`block level backup methods
1316
mongodump <database-dumps>`" sections to implement the backup
1417
solution that is best suited to your deployment's needs.
1518

19+
TODO: why are some links in quotes and some not? (see: backups using mongodump
20+
vs. block level...)
21+
1622
.. note::
1723

1824
:term:`Replica sets <replica set>` and :term:`shard clusters <shard
@@ -33,21 +39,21 @@ Overview
3339
If you are familiar with backups systems in the context of database
3440
systems please skip ahead to :ref:`backup considerations <backup-considerations>`.
3541

36-
With MongoDB, the best way to are two major approaches to backups:
42+
With MongoDB, there are two major approaches to backups:
3743
using system-level tools, like disk image snapshots, and using various
38-
capacities present in the :ref:`mongodump tool <database-dumps>`
39-
to provide backup functionality. The underlying goal of these
40-
strategies is to produce a full copy of the data that you can use to
41-
bring up a new or replacement database instance.
44+
capacities present in the :ref:`mongodump tool <database-dumps>`.
45+
The underlying goal of these strategies is to produce a full and consistent
46+
copy of the data that you can use to bring up a new or replacement
47+
database instance.
4248

4349
The methods described in this document operate by copying the data
44-
file on the disk level. If your system does not provide a capacity for
50+
file on the disk level. If your system does not provide functionality for
4551
this kind of backup, see the section on :ref:`using database dumps for
4652
backups <database-dumps>`" for more information.
4753

48-
One of the leading challenges for producing reliable backups from
49-
database systems is ensuring that the state captured backup methods is
50-
in a consistent and steerable state. Because every environment is
54+
One of the primary challenges for producing reliable backups of
55+
database systems is ensuring that the state captured during backup is
56+
in a consistent and usable???? state. Because every environment is
5157
unique it's important to regularly test the backups that you capture
5258
to ensure that your backup system is practically, and not just
5359
theoretically, functional.
@@ -62,10 +68,10 @@ factors:
6268

6369
- Geography. Ensure that you move some backups away from the your
6470
primary database infrastructure. It's important to be able to
65-
restore your database if you loose access to a system or site.
71+
restore your database if you lose access to a system or site.
6672

6773
- System errors. Ensure that your backups can survive situations where
68-
hardware failures, disk errors, may impact the integrity or
74+
hardware failures, disk errors, or ???? may impact the integrity or
6975
availability of your backups.
7076

7177
- Production constraints. Backup operations themselves sometimes
@@ -74,11 +80,11 @@ factors:
7480
windows.
7581

7682
- System capabilities. In order to use some of the block-level
77-
snapshot tools require special support on the operating-system or
83+
snapshot tools requires special support on the operating-system or
7884
infrastructure level.
7985

8086
- Database configuration. Cluster configuration including replication
81-
and sharding can affect the procured, timing, and impact of the
87+
and sharding can affect the process???, timing, and impact of the
8288
backup process.
8389

8490
- Actual requirements. You may be able to save time, effort, and space
@@ -88,12 +94,12 @@ factors:
8894
With this information in hand you can begin to develop a backup plan
8995
for your database. Remember that all backup plans must be:
9096

91-
- tested. If you cannot effectively restore your database from the
97+
- Tested. If you cannot effectively restore your database from the
9298
backup, then your backups are useless. Test backup restoration
9399
regularly in practical situations to ensure that your backup system
94100
provides value.
95101

96-
- automated. Database backups need to run regularly and
102+
- Automated. Database backups need to run regularly and
97103
automatically. Also automate tests of backup restoration.
98104

99105
.. _block-level-backup:
@@ -105,15 +111,15 @@ This section will provides an overview of using disk/block level
105111
snapshots (i.e. :term:`LVM` or storage appliance) to backup a MongoDB
106112
instance. These tools make a quick block-level backup of the device
107113
that holds MongoDB's data files. These methods complete quickly, work
108-
reliably, and typically provide the easiest backup systems methods to
114+
reliably, and typically provide the easiest backup systems method to
109115
implement.
110116

111117
Snapshots typically work by creating pointers between the live data
112-
and a special snapshot data, you can think about these as "hard
113-
links." Then, as the working data diverges from the snapshot, the
118+
and a special snapshot data partition???, you can think about these as "hard
119+
links." Then, as the working data diverges from the snapshot, these
114120
systems use a copy-on-write strategy. As a result the snapshot only
115121
stores modified data. After making the snapshot, you will mount the
116-
snapshot image and copy the files off disk image. The resulting backup
122+
snapshot image and copy the files off the???? disk image. The resulting backup
117123
contains full copies of all the data.
118124

119125
Snapshots have the following limitations:
@@ -122,9 +128,13 @@ Snapshots have the following limitations:
122128
snapshot takes place. With journaling all states are recoverable,
123129
without journaling you must flush all pending writes to disk.
124130

131+
TODO Might should explain this in more detail. Esp that snapshot with
132+
journal needs journal to be on same volume as data, which in itself
133+
has tradeoffs.... Often confuses people
134+
125135
- Snapshots create an image of an entire disk image. Unless you need
126136
to back up your entire system, consider isolating your MongoDB data
127-
files, journal (if applicable,) and configuration on one logical
137+
files, journal (if applicable), and configuration on one logical
128138
disk that doesn't contain any other data.
129139

130140
Alternately, store all MongoDB data files on a dedicated device to
@@ -138,10 +148,12 @@ Snapshots have the following limitations:
138148
With Journaling
139149
~~~~~~~~~~~~~~~
140150

141-
If your system has a snapshot capability and :program:`mongod` instance
151+
If your system has snapshot capability and your :program:`mongod` instance
142152
has journaling enabled then you can use any kind of file system or
143153
volume/block level snapshot tool to create backups.
144154

155+
TODO: do you need the note and the warning? Just warning?
156+
145157
.. note::
146158

147159
Journaling is not enabled by default on systems running with 32-bit
@@ -150,11 +162,13 @@ volume/block level snapshot tool to create backups.
150162
.. warning::
151163

152164
MongoDB disables journaling on 32 bit systems and all pre-1.9.2
153-
64-bit versions. Specify the ":setting:`journal` = ``true``" in the
165+
64-bit versions. Specify ":setting:`journal` = ``true``" in the
154166
configuration or use the :option:`--journal <mongod --journal>`
155167
run-time option for :program:`mongod` to ensure that MongoDB uses
156168
journaling.
157169

170+
TODO: I don't quite understand the wording in this block
171+
158172
Many service providers provide a block-level backup service based on
159173
disk image snapshots. If you manage your own infrastructure on a
160174
Linux-based system, configure your system with :term:`LVM` to provide
@@ -168,6 +182,7 @@ LVM-based setups *within* a cloud/virtualized environment.
168182

169183
If you use Amazon's EBS service in a software RAID 10 (e.g. 1+0)
170184
configuration, use LVM to capture a consistent disk image.
185+
TODO: link to Amazon section in this file
171186

172187
The following sections provide an overview of a simple backup process
173188
using LVM on a Linux system. While the tools, commands, and paths may
@@ -186,7 +201,7 @@ following format:
186201
187202
lvcreate --size 100M --snapshot --name mdb-snap01 /dev/vg0/mongodb
188203
189-
This command creates a lvm snapshot (with the "``--snapshot`` option)
204+
This command creates an LVM snapshot (with the "``--snapshot`` option)
190205
named "``mdb-snap01``" of the "``mongodb``" volume in the "``vg0``"
191206
volume group.
192207

@@ -204,13 +219,13 @@ current state of ``/dev/vg0/mongodb`` and the creation of the snapshot
204219
.. warning::
205220

206221
Ensure that you create snapshots with enough space to account for
207-
data growth, particularly for a period of that it takes to copy to
222+
data growth, particularly for the period of time that it takes to copy
208223
data out of the system or to a temporary image.
209224

210225
If you your snapshot runs out of space, the snapshot image
211-
becomes unusable. You discard this LVM and create another.
226+
becomes unusable. Discard this LVM and create another.
212227

213-
The snapshot exists when the command returns. You can restore
228+
The snapshot has been created when the command returns. You can restore
214229
directly from the snapshot at any time or by creating a new logical
215230
volume and restoring from this snapshot to the alternate image.
216231

@@ -223,8 +238,8 @@ that you archive these snapshots and store them elsewhere.
223238
Archive Snapshots
224239
`````````````````
225240

226-
After creating a snapshot, mount the snapshot and move the data to a
227-
separate storage You. system may wish to compress the backup images as
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
228243
you move the offline. Consider the following procedure to fully
229244
archive the data from the snapshot:
230245

@@ -282,8 +297,8 @@ This sequence:
282297

283298
.. _backup-restore-from-snapshot:
284299

285-
Restore Directly from a Snapshots
286-
`````````````````````````````````
300+
Restore Directly from a Snapshot
301+
````````````````````````````````
287302

288303
To combine the above processes without writing to a compressed ``tar``
289304
archive, use the following sequence:
@@ -311,7 +326,7 @@ procedure:
311326
mount /dev/vg0/mdb-new /srv/mongodb
312327
313328
This sequence is identical to procedures explained above except that
314-
the output direct input (i.e. :term:`piped <pipe>`) over SSH to the
329+
the output direct input ???? (i.e. :term:`piped <pipe>`) over SSH to the
315330
remote system.
316331

317332
.. _backup-without-journaling:
@@ -320,10 +335,15 @@ Without Journaling
320335
~~~~~~~~~~~~~~~~~~
321336

322337
If your :program:`mongod` instance does not run with journaling
323-
enabled, obtaining a functional backup of a consistent state is more
338+
enabled (OR if your journal is on a separate volume), obtaining a
339+
functional backup of a consistent state is more
324340
complicated. Flush all writes to disk and lock the database to prevent
325341
writes during the backup process.
326342

343+
TODO: Need to recommend that this is done on a secondary which is not
344+
currently receiving reads, e.g., hidden secondary. Need to specify
345+
what db.fsyncLock() does and link.
346+
327347
To flush writes and lock the database before performing the snapshot,
328348
issue the following command:
329349

@@ -342,7 +362,8 @@ completed, issue the following command:
342362
.. note::
343363

344364
Version 1.9.0 added :func:`db.fsyncLock()` and
345-
:func:`db.fsyncUnlock()` helpers to the :program:`mongo` shell.
365+
:func:`db.fsyncUnlock()` helpers to the :program:`mongo` shell. Prior to this
366+
version, use the following commands:
346367

347368
.. code-block:: javascript
348369

0 commit comments

Comments
 (0)