How to Backup MongoDB to SnapShooter Storage
Data is an important asset of any organization. To keep the data safe, we need a database backup. Data backup is one of the most highly required processes for any database management system. You can restore your data from the backup in the event of system or database failure. SnapShooter is a cloud-based database backup solution provider that provides an easier way to automate backup with ease.
SnapShooter storage is cloud storage based on AWS that allows you to store your MongoDB database backup without using any third-party cloud storage. SnapShooter Storage is available in every AWS region around the world.
This post will show you how to backup the MongoDB database to SnapShooter Storage.
Connect MongoDB Server to SnapShooter
Before starting, you will need to connect your SnapShooter Account to the server where your MongoDB database is hosted.
First, go to the SnapShooter website and register for their 14-day free trial.
Next, log in to the SnapShooter and click on the Servers in the left sidebar. You should see the following screen:
Click on the Connect Server. You should see the following screen:
Now, copy and paste the following code shown on the above screen to your MongoDB server.
curl -sSL "https://ingestor.snapshooter.com/api/server/add?token=eyJpdiI6IjU2RHVoRmZkL3dHRmtwbFU3ZXYwL0E9PSIsInZhbHVlIjoiemtoeE5CK05DNDRhcUcvaTFxOVJ4dz09IiwibWFjIjoiZGY5N2ZmM2VhM2Q1ZjUwZTQwMzg5NGFmY2Y4ODU5ZGI2YjZlNjMwODUwMzE2YWVkMTkyYjUyODYxMTNiOGUyNCIsInRhZyI6IiJ9&key=5895" | bash
Once your server is connected to the SnapShooter. You will get the following output:
Welcome to SnapShooter Server SetupEnvironment Detected: OS: linux, OS Type: amd64Installing SSH public keyCreating temp SSH key filegrep: /root/.ssh/authorized_keys: No such file or directorycp: cannot stat '/root/.ssh/authorized_keys': No such file or directoryCreating authorized_keys backup /root/.ssh/authorized_keys.bak-1650962037Key Installed /root/.ssh/authorized_keysRemoving temp SSH key fileScanning SSH configChecking 22matched (22)SSH test confirmed, Server Added to SnapShooter ...
Next, go back to your SnapShooter dashboard, you should see your added server on the following screen:
How to Backup MongoDB Database to SnapShooter Storage
Next, you will need to create a backup job to automate MongoDB database backup to SnapShooter Storage.
Follow the below steps to Backup the MongoDB database to SnapShooter Storage:
Step 1 - On the SnapShooter dashboard, click on the Backup Jobs in the left sidebar. You should see the following screen:
Step 2 - Click on the Create New Job. You should see the various database option on the following screen:
Step 3 - Click on the MongoDB Database. You should see the following screen:
Step 4 - Define your backup name and click on the Continue button. You should see the Add Your Server screen:
Step 5 - Here, select your MongoDB server which you have added in the previous step, and click on the Next button. You should see the following screen:
Step 6 - Provide MongoDB database username, password, database, and click on the Test button to test the connection. If everything is fine, you should see the following screen:
Step 7 - Click on the Save and Next button. You should see the Storage Selection screen:
Step 8 - Here, you will need to define your SnapShooter Storage to store your database backup. Click on the Add New Storage Provider. You should see the following screen:
Step 9 - Click on the Use SnapShooter Storage button. You should see the following screen:
Step 10 - Select your SnapShooter Storage region and click on the Create Bucket button. You should see the job schedule screen:
Step 11 - Select your SnapShooter Storage and click on the Set Storage button. You should see the following screen:
Step 12 - Here, you can select the pre-defined backup schedule and backup retention policy then click on the Set Schedule and Finish button. You should see the following screen:
Step 13 - Click on the Backup Now button to run your first backup job. Once your backup job is executed successfully, you should see the following screen:
Depending on your compression level and the size of the backup, it may take time to complete. Every minute SnapShooter will go and check the process to see how far it has got. Using the Log button, you can see the latest state the backup is in.
In this guide, you learned how to backup the MongoDB database to SnapShooter Storage. You can now create your own backup policy, customize it and run it at a pre-defined interval of time.
Thank you for helping us improve!