Restoring Your Scalingo for PostgreSQL® Addon
Restoring a Point-in-Time Recovery Backup
Point-in-time recovery (PiTR) allows you to ask for the restoration of your data at a specific date. We achieve this by making a full PiTR backup of the database weekly. Between two full PiTR backups, we keep track of the write-ahead logs (WAL). The WAL contains all the modification instructions. By replaying the WAL from a full PiTR backup to a specific date, we are able to rebuild the state of the database at that particular date.
Using the Database Dashboard
- From your web browser, open your database dashboard
- Click the Backups tab
- Locate the Point-in-Time Recovery block
- Click the Start a PiTR button
- Pick a date and time (timezone is UTC)
- Make sure to check the I understand that this action will permanently delete existing data and cannot be cancelled or undone once started. checkbox
- Validate by clicking the Confirm button
Restoring a Periodic Backup
Using the Command Line
From a One-Off Container
- Follow the procedure to access your PostgreSQL® database from a one-off container
- From the one-off command line, download and install the Scalingo command
line tool to complete the one-off setup:
install-scalingo-cli
- Login to Scalingo:
scalingo login
- Either download a backup, or use a dump made previously
- Uncompress the backup (this step is not necessary with a dump):
tar -xvzf <archive>
- Restore the database from the uncompressed file or from the dump, using the
pg_restore
command:pg_restore --clean --if-exists --no-owner --no-privileges --no-comments --dbname "${SCALINGO_POSTGRESQL_URL}" <dump_file>
From Your Workstation
- Either download a backup, or create a dump
- Uncompress the backup (this step is not necessary with a dump):
tar -xvzf <archive>
- Open a DB tunnel so you can access your database from your workstation
- Adjust the connection URI:
export SCALINGO_DATABASE_URL="postgresql://<user>:<password>@127.0.0.1:<port>/<dbname>"
With
user
,password
anddbname
from your original connection URI andport
depending on what you did (default is10000
) - Restore the database from the uncompressed file or from the dump, using the
pg_restore
command (you may have to install it):pg_restore --clean --if-exists --no-owner --no-privileges --no-comments --dbname "${SCALINGO_DATABASE_URL}" <dump_file>
Restoring a Manual Backup
Manual backups are considered like any Periodic backup. Consequently, please refer to the documentation explaining how to restore a Periodic backup.
Restoring a Dump
Dumps are considered like any Periodic backup. Consequently, please refer to the documentation explaining how to restore a Periodic backup.