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

  1. From your web browser, open your database dashboard
  2. Click the Backups tab
  3. Locate the Point-in-Time Recovery block
  4. Click the Start a PiTR button
  5. Pick a date and time (timezone is UTC)
  6. Make sure to check the I understand that this action will permanently delete existing data and cannot be cancelled or undone once started. checkbox
  7. Validate by clicking the Confirm button

Restoring a Periodic Backup

Using the Command Line

From a One-Off Container

  1. Follow the procedure to access your PostgreSQL® database from a one-off container
  2. From the one-off command line, download and install the Scalingo command line tool to complete the one-off setup:
    install-scalingo-cli
    
  3. Login to Scalingo:
    scalingo login
    
  4. Either download a backup, or use a dump made previously
  5. Uncompress the backup (this step is not necessary with a dump):
    tar -xvzf <archive>
    
  6. 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

  1. Either download a backup, or create a dump
  2. Uncompress the backup (this step is not necessary with a dump):
    tar -xvzf <archive>
    
  3. Open a DB tunnel so you can access your database from your workstation
  4. Adjust the connection URI:
    export SCALINGO_DATABASE_URL="postgresql://<user>:<password>@127.0.0.1:<port>/<dbname>"
    

    With user, password and dbname from your original connection URI and port depending on what you did (default is 10000)

  5. 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.


Suggest edits

Restoring Your Scalingo for PostgreSQL® Addon

©2024 Scalingo