/
restore-replica-set-from-backup.txt
66 lines (46 loc) · 2.12 KB
/
restore-replica-set-from-backup.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
==========================================
Restore a Replica Set from MongoDB Backups
==========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
This procedure outlines the process for taking MongoDB data and
restoring that data into a new :term:`replica set`. Use this approach
for seeding test deployments from production backups as well as part
of disaster recovery.
You *cannot* restore a single data set to three new
:binary:`~bin.mongod` instances and *then* create a replica set. In this
situation MongoDB will force the secondaries to perform an initial
sync. The procedures in this document describe the correct and
efficient ways to deploy a replica set.
Restore Database into a Single Node Replica Set
-----------------------------------------------
.. include:: /includes/steps/restore-primary-from-backup.rst
.. include:: /includes/replacement-mms.rst
Add Members to the Replica Set
------------------------------
MongoDB provides two options for restoring secondary members of a
replica set:
- Manually copy the database files to each data directory.
- Allow :ref:`initial sync <replica-set-initial-sync>` to distribute
data automatically.
The following sections outlines both approaches.
.. note::
If your database is large, initial sync can take a long time to
complete. For large databases, it might be preferable to copy the
database files onto each host.
Copy Database Files and Restart :binary:`~bin.mongod` Instance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use the following sequence of operations to "seed" additional members
of the replica set with the restored data by copying MongoDB data
files directly.
.. include:: /includes/steps/restore-secondary-from-backup-directly.rst
Update Secondaries using Initial Sync
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use the following sequence of operations to "seed" additional members
of the replica set with the restored data using the default *initial
sync* operation.
.. include:: /includes/steps/restore-secondary-from-backup-initial-sync.rst