Subscribe

ONTAP Recipes: Easily restore a MongoDB Database using MongoDB Ops Manager

[ Edited ]

ONTAP Recipes: Did you know you can…?

 

Easily restore a MongoDB Database using MongoDB Ops Manager

 

MongoDB and NetApp have worked together to integrate the MongoDB Ops Manager utility with NetApp’s AltaVault Virtual Appliance (AVA), for MongoDB backups.

 

Restore operations are performed entirely within the Ops Manager framework. The steps for restoring MongoDB data from an Ops Manager backup are listed below:

 

1. Open a browser session and enter the fully qualified URL and port number of the Ops Manager Application.

 

In the example URL below, “opsmgrhost.netapp.com” is the fully qualified hostname of the Ops Manager host, and “8080” is the Ops Manager port:

 

http://opsmgrhost.netapp.com:8080

 

An IP address can be used in place of the hostname.

 

2. Enter the required credentials on the home page.

 

3. Click the “Admin” link at the top of the screen.

 

4. Click the “Backup” tab on the left side of the screen and you’ll be directed to the “Backup” screen.

 

5. Select either “Sharded Cluster Status” or “Replica Set Status”. For this example, we’ll be restoring a replica set.

 

6. Click the name of the sharded cluster to restore.

 

7. Click the “RESTORE” button that corresponds to the desired snapshot (Figure 1).

 

Picture5.png

 

Figure 1: Screen for restoring MongoDB from a backup

 

The “Select Restore Destination” screen will appear (Figure 2).

 

8. Choose the “PUSH VIA SECURE COPY” option at the top and populate the required fields.

 

In this example, a tar file containing the backup files will be pushed out the MongoDB primary replica server, which has an IP address of 192.168.13.201, using scp.  The copy will be performed using the target server’s root user credentials, and the destination folder is “/mongodb/data”.  Click on the green “FINALIZE REQUEST” button at the bottom to start the process.

 

Picture6.png

 

Figure 2: Select Restore Destination

 

9. Log in to the destination server, locate the tar file and unbundle it using Linux command

   

  tar xvf

 

10. Use the Linux “cd” command to move into the new directory, and verify that the owner and group are “mongod”.

 

 If not, use the “chown -R” command to change them

 

11. As the root user, execute the following command to start a new MongoDB instance running under a port that is different from the original production instance:

 

sudo -u mongod mongod -–dbpath /mongodb/data/ntap1bkp -–directoryperdb –-port 27018

 

In this example, port 27018 was used.  The directory containing the unbundled restore files is /mongodb/data/ntap1bkp

 

12. As the root user, connect to the new instance using the command:

 

mongo -–port 27018

 

13. Use the MongoDB commands “show dbs” and “show collections” to verify that the restore was successful and complete. Other queries may be used for a more rigorous check of the new instance.

 

14. The new instance can be promoted to production, or used for restoring individual databases or collections to the original production instance.

 

 

For more information, see the ONTAP 9 documentation center

 

For more information on how to retrieve a Snapshot with SCP delivery, refer to the following document:

 

https://docs.opsmanager.mongodb.com/v1.6/tutorial/retrieve-snapshot-scp/

Re: ONTAP Recipes: Easily restore a MongoDB Database using MongoDB Ops Manager

Thanks for sharing this information.

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.