1
- =================================
2
- Backup and Restoration Strategies
3
- =================================
1
+ =================
2
+ Backup Strategies
3
+ =================
4
4
5
5
.. default-domain:: mongodb
6
6
7
- This document describes database backup strategies for
8
- use with MongoDB. This document contains the following sections:
9
-
10
- - :ref:`backup-overview` and :ref:`backup-considerations` describe the
11
- approaches for backing up your MongoDB environment.
12
-
13
- - :ref:`sharded-cluster-backups` describes considerations specific to
14
- :term:`sharded clusters <sharded cluster>`.
15
-
16
- - :ref:`replica-set-backups` describes considerations
17
- specific to :term:`replica sets <replica set>`.
18
-
19
- See also:
20
-
21
- - :doc:`/tutorial/backup-databases-with-filesystem-snapshots`
22
-
23
- - :doc:`/tutorial/backup-databases-with-binary-database-dumps`
24
-
25
- .. _backup-overview:
26
-
27
- Backup Strategies
28
- -----------------
29
-
30
- For MongoDB production systems, you should implement a strategy
31
- for taking and restoring backups. The goal of a backup strategy is to
32
- produce a full and consistent copy of the data to use to
33
- bring up a new or replacement database instance. In some
34
- cases, taking backups is difficult or impossible, given large data
35
- volumes, distributed architectures, and data transmission speeds.
7
+ You should have an automated backup system for your MongoDB environment.
8
+ The backup system must capture data in a consistent and usable state and
9
+ in a way that can be reliably reproduced. The backup system must be
10
+ automated and run regularly. And the system must be regularly tested in
11
+ practical situations to ensure that your backups are functional. If you
12
+ cannot effectively restore your database from the backup, then your
13
+ backups are useless. You also should automate tests of backup
14
+ restoration.
36
15
37
- Nevertheless, with MongoDB, there are two major approaches to backups:
38
- [#replication-as-backups]_
16
+ Use one of the following tools for backing up your MongoDB
17
+ environment:
39
18
40
- - Using system-level tools, like disk image snapshots.
19
+ - Use system-level tools that perform block-level backups (also called
20
+ disk-image snapshots).
41
21
42
22
See :doc:`/tutorial/backup-databases-with-filesystem-snapshots`.
43
23
44
- - Using various capacities present in the :program:`mongodump` tool.
24
+ - Use the :program:`mongodump` tool.
45
25
46
26
See :doc:`/tutorial/backup-databases-with-binary-database-dumps`.
47
27
48
- The methods described in this document operate by copying the data file
49
- on the disk level. If your system does not provide functionality for
50
- this kind of backup, see :doc:`/tutorial/backup-databases-with-binary-database-dumps`.
51
-
52
- Ensuring that the state captured by the backup is consistent and usable
53
- is the primary challenge of producing backups of database systems.
54
- Backups that you cannot produce reliably, or restore from feasibly are
55
- worthless.
56
-
57
- As you develop your backup system, take into consideration the specific
58
- features of your deployment, your use patterns, and your architecture.
59
-
60
- Because every environment is unique it's important to regularly test the
61
- backups that you capture to ensure that your backup system is
62
- practically, and not just theoretically, functional.
63
-
64
- .. [#replication-as-backups] In many situations increasing the amount
65
- of replication provides useful assurances with data sets that are
66
- difficult to restore in a timely manner.
28
+ In some cases, taking backups is difficult or impossible because of
29
+ large data volumes, distributed architectures, and data transmission
30
+ speeds. In these situations, increase the amount of replication.
67
31
68
32
.. _backup-considerations:
69
33
70
- Production Considerations for Backup Strategies
71
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34
+ Backup Considerations
35
+ ---------------------
72
36
73
- When evaluating a backup strategy for your MongoDB deployment consider
37
+ As you develop a backup strategy for your MongoDB deployment consider
74
38
the following factors:
75
39
76
40
- Geography. Ensure that you move some backups away from the your
77
- primary database infrastructure. It's important to be able to
78
- restore your database if you lose access to a system or site.
41
+ primary database infrastructure.
79
42
80
43
- System errors. Ensure that your backups can survive situations where
81
44
hardware failures or disk errors impact the integrity or
82
45
availability of your backups.
83
46
84
- - Production constraints. Backup operations themselves sometimes
85
- require substantial system resources. It's important to consider the
86
- time of the backup schedule relative to peak usage and maintenance
87
- windows.
47
+ - Production constraints. Backup operations themselves sometimes require
48
+ substantial system resources. It is important to consider the time of
49
+ the backup schedule relative to peak usage and maintenance windows.
88
50
89
- - System capabilities. Some of the block-level
90
- snapshot tools requires special support on the operating-system or
91
- infrastructure level.
51
+ - System capabilities. Some of the block-level snapshot tools requires
52
+ special support on the operating-system or infrastructure level.
92
53
93
54
- Database configuration. :term:`Replication` and :term:`sharding
94
- <shard>` can affect the process, and impact of the backup implementation.
55
+ <shard>` can affect the process and impact of the backup
56
+ implementation. See :ref:`sharded-cluster-backups` and
57
+ :ref:`replica-set-backups`.
95
58
96
59
- Actual requirements. You may be able to save time, effort, and space
97
60
by including only crucial data in the most frequent backups and
98
61
backing up less crucial data less frequently.
99
62
100
- With this information in hand you can begin to develop a backup plan
101
- for your database. Remember that all backup plans must be:
102
-
103
- - Tested. If you cannot effectively restore your database from the
104
- backup, then your backups are useless. Test backup restoration
105
- regularly in practical situations to ensure that your backup system
106
- provides value.
107
-
108
- - Automated. Database backups need to run regularly and
109
- automatically. Also automate tests of backup restoration.
110
-
111
63
.. _sharded-cluster-backups:
112
64
113
65
Sharded Cluster Backup Considerations
114
- -------------------------------------
66
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115
67
116
68
.. include:: /includes/note-shard-cluster-backup.rst
117
69
118
- :term:`Sharded clusters <sharded cluster>` complicate backup operations, as distributed
119
- systems. True point-in-time backups are only possible when stopping all write
120
- activity from the application. To create a precise moment-in-time
121
- snapshot of a cluster, stop all application write activity to the
122
- database, capture a backup, and only allow write operations to the
123
- database after the backup is complete.
70
+ :term:`Sharded clusters <sharded cluster>` complicate backup operations,
71
+ as distributed systems. True point-in-time backups are only possible
72
+ when stopping all write activity from the application. To create a
73
+ precise moment-in-time snapshot of a cluster, stop all application write
74
+ activity to the database, capture a backup, and allow only write
75
+ operations to the database after the backup is complete.
124
76
125
77
However, you can capture a backup of a cluster that **approximates** a
126
78
point-in-time backup by capturing a backup from a secondary member of
@@ -129,7 +81,7 @@ same moment. If you decide to use an approximate-point-in-time backup
129
81
method, ensure that your application can operate using a copy of the
130
82
data that does not reflect a single moment in time.
131
83
132
- The following documents describe all sharded cluster related backup
84
+ The following documents describe sharded cluster related backup
133
85
procedures:
134
86
135
87
- :doc:`/tutorial/backup-small-sharded-cluster-with-mongodump`
@@ -142,23 +94,24 @@ procedures:
142
94
.. _replica-set-backups:
143
95
144
96
Replica Set Backup Considerations
145
- ---------------------------------
97
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146
98
147
99
In most cases, backing up data stored in a :term:`replica set` is
148
- similar to backing up data stored in a single instance. It's possible to
149
- lock a single :term:`secondary` or :term:`slave` database and then
150
- on create a backup from that instance. When you unlock the database, the secondary or
151
- slave will catch up with the :term:`primary` or :term:`master`. You may also
152
- chose to deploy a dedicated :term:`hidden member` for backup purposes.
153
-
154
- If you have a :term:`sharded cluster` where each :term:`shard` is itself a replica
155
- set, you can use this method to create a backup of the entire cluster
156
- without disrupting the operation of the node. In these situations you
157
- should still turn off the balancer when you create backups.
158
-
159
- For any cluster, using a non-primary/non-master node to create backups is
160
- particularly advantageous in that the backup operation does not
161
- affect the performance of the primary or master. Replication
162
- itself provides some measure of redundancy. Nevertheless, keeping
163
- point-in time backups of your cluster to provide for disaster recovery
164
- and as an additional layer of protection is crucial.
100
+ similar to backing up data stored in a single instance. It is possible
101
+ to lock a single :term:`secondary` database and then create a backup
102
+ from that instance. When you unlock the database, the secondary will
103
+ catch up with the :term:`primary`. You may also choose to deploy a
104
+ dedicated :term:`hidden member` for backup purposes.
105
+
106
+ If you have a :term:`sharded cluster` where each :term:`shard` is itself
107
+ a replica set, you can use this method to create a backup of the entire
108
+ cluster without disrupting the operation of the node. In these
109
+ situations you should still turn off the balancer when you create
110
+ backups.
111
+
112
+ For any cluster, using a non-primary node to create backups is
113
+ particularly advantageous in that the backup operation does not affect
114
+ the performance of the primary. Replication itself provides some measure
115
+ of redundancy. Nevertheless, keeping point-in time backups of your
116
+ cluster to provide for disaster recovery and as an additional layer of
117
+ protection is crucial.
0 commit comments