How to Backup PostgreSQL to SnapShooter Storage SnapShooter Storage
Introduction
If you are using PostgreSQL in a production or live environment, it is important to backup the PostgreSQL database ensures that your users' data is not lost. PostgreSQL has some built-in tools to backup your database easily. However, manually backing up the database is a very time-consuming process. In this case, you can use the SnapShooter backup solution to automate PostgreSQL backup with ease.
SnapShooter provides AWS-based cloud storage that allows you to store your PostgreSQL database backup without using any third-party cloud storage. SnapShooter Storage gives you the power and redundancy of AWS and is available in every AWS region around the world.
This post will show you how to backup the PostgreSQL database to SnapShooter Storage.
Connect PostgreSQL Server to SnapShooter
Before starting, you will need to connect your SnapShooter Account to the server where your PostgreSQL database is hosted.
First, go to the SnapShooter website and register for their 14-day free trial.
Once you are logged in, 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 PostgreSQL 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 fileCreating 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 PostgreSQL Database to SnapShooter Storage
Next, you will need to create a backup job to automate PostgreSQL database backup to SnapShooter Storage.
Follow the below steps to Backup the PostgreSQL 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 PostgreSQL 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 PostgreSQL server which you have added in the previous step, and click on the Next button. You should see the following screen:
Step 6 - Provide the PostgreSQL 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. 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.
Scheduled PostgreSQL Single Databases Backups SnapShooter
Backup a single PostgreSQL database to your external storage
Learn more about PostgreSQL Single Databases Backups
Get started for freeConclusion
In this guide, we explained how to backup the PostgreSQL database to SnapShooter Storage. You can now manage and control all your backup from the centralized location.
Thank you for helping us improve!