- Back Up and Restore Deployments >
- Restore MongoDB Deployments >
- Restore a Replica Set from a Snapshot
Restore a Replica Set from a Snapshot¶
On this page
When you restore a replica set from backup, Ops Manager provides you with a restore file for the selected restore point. To learn about the restore process, please see Restore Overview.
- FCV 4.2 or later
- FCV 4.0 or earlier
Considerations¶
Review change to BinData
BSON sub-type¶
The BSON specification changed the
default subtype for the BSON binary datatype (BinData
) from 2
to 0
. Some binary data stored in a snapshot may be BinData
subtype 2. The Backup automatically detects and converts snapshot
data in BinData
subtype 2 to BinData
subtype 0. If your
application code expects BinData
subtype 2, you must update your
application code to work with BinData
subtype 0.
See also
The notes on the BSON specification explain the particular specifics of this change.
Restore using settings given in restoreInfo.txt
¶
The backup restore file includes a metadata file named
restoreInfo.txt
. This file captures the options the database used
when the snapshot was taken. The database must be run with the listed
options after it has been restored. This file contains:
Group name
Replica Set name
Cluster ID (if applicable)
Snapshot timestamp (as Timestamp at UTC)
Restore timestamp (as a BSON Timestamp at UTC)
Last Oplog applied (as a BSON Timestamp at UTC)
MongoDB version
Storage engine type
mongod startup options
used on the database when the snapshot was takenEncryption (Only appears if encryption is enabled on the snapshot)
Master Key UUID (Only appears if encryption is enabled on the snapshot)
If restoring from an encrypted backup, you must have a certificate provisioned for this Master Key.
Backup Considerations¶
All FCV databases must fulfill the appropriate backup considerations.
Prerequisites¶
To perform manual restores, you must have the Backup Admin role in Ops Manager.
To restore from an encrypted backup, you need the same master key used to encrypt the backup and either the same certificate as is on the Backup Daemon host or a new certificate provisioned with that key from the KMIP host.
If the snapshot is encrypted, the restore panel displays the KMIP
master key id and the KMIP server information. You can also find
the information when you view the snapshot itself as well as in
the restoreInfo.txt
file.
Client Requests During Restoration¶
You must ensure that the MongoDB deployment does not receive client requests during restoration. You must either:
- Restore to new systems with new hostnames and reconfigure your application code once the new deployment is running, or
- Ensure that the MongoDB deployment will not receive client requests while you restore data.
Restore a Snapshot¶
- Automatic Restore
- Manual Restore
To have Ops Manager automatically restore the snapshot:
Click Continuous Backup, then the Overview tab.¶
Click the deployment, then click Restore or Download.¶
Select the restore point.¶
Choose the point from which you want to restore your backup.
Restore Type Description Action Snapshot Allows you to choose one stored snapshot. Select an existing snapshot to restore. Point In Time Creates a custom snapshot that includes all operations up to but not including the selected time. By default, the Oplog Store stores 24 hours of data.
Example
If you select
12:00
, the last operation in the restore is11:59:59
or earlier.Important
In FCV 4.0, you cannot perform a PIT restore that covers any time prior to the latest backup resync. For the conditions that cause a resync, see Resync a Backup. This note does not apply to FCV 4.2 or later.
Select a Date and Time. Oplog Timestamp Creates a custom snapshot that includes all operations up to and including the entered Oplog timestamp. The Oplog Timestamp contains two fields:
Timestamp Timestamp in the number of seconds that have elapsed since the UNIX epoch Increment Order of operation applied in that second as a 32-bit ordinal. Type an Oplog Timestamp and Increment.
Run a query against
local.oplog.rs
on your replica set to find the desired timestamp.Click Next.
Choose to restore the files to another cluster.¶
Click Choose Cluster to Restore to.
Complete the following fields:
Field Action Project Select a project to which you want to restore the snapshot. Cluster to Restore to Select a cluster to which you want to restore the snapshot.
Ops Manager must manage the target replica set.
Warning
Automation removes all existing data from the cluster. All backup data and snapshots for the existing cluster are preserved.
Click Restore.
Ops Manager notes how much storage space the restore requires.
Click Restore.¶
Important
Rotate Master Key after Restoring Snapshots Encrypted with AES256-GCM
If you restore an encrypted snapshot that Ops Manager encrypted with AES256-GCM, rotate your master key after completing the restore.