You can restore MongoDB data to the location where you performed the backup operation.
Before You Begin
Review the following requirements:
-
If you have scheduled operation log dump backups, disable the operation log dump backups. See Disabling Operation Log Dump Backups.
-
In case of a Sharded cluster deployment, stop the mongos service.
Use
db.shutdownServer()
to ensure a clean shutdown. -
Stop the mongod service on all the nodes of all the replication sets, including the config server replication set.
Use
--shutdown
ordb.shutdownServer()
to ensure a clean shut down -
Clear the data directory paths on all the nodes.
-
Before cleanup, make a copy of the MongoDB configuration file, especially if the file is in the dbpath directory. The configuration file is required to start the server after the restore operation.
-
During recovery, the MongoDB log file is created in the /var/log/mongodb directory if the directory exists. Otherwise, the MongoDB log file is created in the /var/log directory. Verify that the operating system user has permissions on this directory to create the log file.
Procedure
-
From the CommCell Browser, expand Client Computers > client > Big Data Apps > instance.
-
Right-click the subclient that contains the data, and then click Browse and Restore.
The Browse and Restore Options dialog box appears.
-
Specify the restore operation that you want to perform:
-
To restore the most recent backup, select Latest Backup.
-
To restore the data to a point-in-time, select Time Range, and then in the Start and End boxes, type the date and time.
The end time must be later than the very next backup job that ran after the point-in-time you select.
Example of point-in-time restore
Consider the following job information for backup operations:
-
Backup type |
Job start time |
Job end time |
---|---|---|
Full |
10:00 am |
10:15 am |
Incremental backup 1 |
10:30 am |
10:35 am |
incremental backup 2 |
11:00 am |
11:05 am |
Incremental backup 3 |
11:30 am |
11:35 am |
Now, suppose that you want to perform a restore operation to a point in time at 10:45 am, enter the end time as 11:06 am because the most recent job succeeded at 11:05 am, which is after the point-in-time that you selected.
-
Click View Content.
-
On the Browse page, determine the data that you want to restore, and then click Recover All Selected.
The Restore Options dialog box appears.
-
On the General tab, select the restore options:
-
From the Destination instance list, select the client computer and instance that you performed the backup operation on.
-
To restore the files, select the Restore files only check box.
-
In the Number of Streams box, type the number of streams that the software uses for the restore operation.
-
-
Optional: Select the advanced restore options. For more information, review the following:
-
On the Recover tab, select the Recover and Apply Oplog Until check box.
-
Specify the recover operation that you want to perform:
- To recover from the most recent backup, select Latest Backup Time.
To recover the database to a point-in time, click Point-in-time, and then select the data and time to which you want to recover the database.
-
Click OK.
What To Do Next
To add additional secondary nodes (if any) to the replication set, complete the following steps:
-
Connect a mongo shell to the restored mongod instance,and then run the following command:
rs.add("hostname:port")
This command will synchronize the member with the data on the primary node.
-
For sharded clusters, start the mongo routing service (mongos) on the required nodes:
mongos --config <path-to-config>