Backup MongoDB Database
Backup MongoDB Database Using SnapShooter
SnapShooter provides an easier way to create a backup, compress it and transfer it automatically from your server to your own storage, in this guide we will use DigitalOcean spaces but feel free to replace it with whatever storage you wish.
Add a Server to Snapshooter
First, you will need to add the MongoDB server to the Snapshooter. Follow the below steps to add a server to Snapshooter:
Step 1 - First, go to the SnapShooter website and register for their 14-day free trial.
Step 2 - On the SnapShooter dashboard, click on the Servers in the left sidebar. You should see the following screen:

Step 3 - Click on the Connect Server. You should see the following screen:

Step 4 - Copy and paste the code shown in the above image to your server:
curl -sSL "https://ingestor.snapshooter.com/api/server/add?token=eyJpdiI6IjdnVCtwanZSYXlSczN5ZkJoM05NalE9PSIsInZhbHVlIjoiNm5PcDBQYTh5bkVXN3dhVzRIWkpLUT09IiwibWFjIjoiODRkOGFhMGRjN2ZkZDVjYTUzMTA5ODA3ZTQ3MDEwMTRjMTQyN2IyZjY3YzIxYTU4ZmJiMjUzZjg4YmEzOTZkMyIsInRhZyI6IiJ9&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-1646286944Key Installed /root/.ssh/authorized_keysRemoving temp SSH key fileScanning SSH configChecking 22matched (22)SSH test confirmed, Server Added to SnapShooter ...
Step 5 - Go back to your web browser, you should see your added server on the following screen:

Attache DigitalOcean Space to Snapshooter
Next, you will need to attack the external backup storage like DigitalOcean space to the SnapShooter.
Click here to attach the DigitalOcean space to SnapShooter. You should see the following screen:

Choose a Friendly Name, Select DigitalOcean Spaces, Select the correct spaces region selected before Paste in saved access key and secret access key, Enter the correct bucket name then Press save button. We will check the API key is valid and works before allowing you to save. Once complete, you are ready to create a Backup Job that uses external storage.
Create a Backup Job to Backup MongoDB Database to DigitalOcean Spaces
Next, you will need to create a backup job to automate MongoDB database backup to DigitalOcean spaces. Follow the below steps to automate database backup:
Next, you will need to create a backup job to automate MongoDB database backup to DigitalOcean spaces. Follow the below steps to automate database backup:
Step 1 - On the SnapShooter dashboard, click on the Backup Jobs in the left pane, you should see the following screen:

Step 2 - Click on the Create New Job. You should see the following screen:

Step 3 - Click on the MongoDB. You should see the following screen:

Step 4 - Provide your backup job name and click on the Continue button. You should see the following screen:

Step 5 - Select your server from where you want to backup the MongoDB database then click on the Next button. You should see the MongoDB configuration screen:


Step 6 - Provide your MongoDB admin name, database name, host, and click on the Test button. Once the database is connected, you should see the following screen:

Step 7 - Click on the Save and Next button. You will be asked to select the external storage:

Step 8 - Select mongodb-dump as storage and click on the Set Storage button. You should see the backup schedule screen:

Step 9 - Define your backup schedule, retention policy and click on the Set Schedule and Finish button. You should see the following screen:

Step 10 - Now, click on the Backup Now button to run your first backup. Once the backup job is executed successfully, you should see the following screen:

You can also verify your backup by accessing the DigitalOcean spaces. You should see your MongoDB database backup on the following screen:

Scheduled MongoDB (Single Databases) Backups SnapShooter
Backup a single MongoDB database to your external storage
Learn more about MongoDB (Single Databases) Backups
Get started for freeThank you for helping us improve!