1. Home
  2. Docs
  3. Backup Ninja
  4. How-To
  5. Scheduling
  6. PostgreSQL/TimescaleDB

PostgreSQL/TimescaleDB

To backup PostgreSQL or TimescaleDB servers, we support the following backup tools:

Backup Tool Type Definition
pg_dumpall, pg_dump Logical It is a utility for writing out all TimescaleDB databases of a cluster into one script file. The script file contains SQL commands that can be used to restore the databases.
pg_basebackup Physical It is used to make a binary copy of the database cluster files while making sure the system is put in and out of backup mode automatically. Backups are always taken of the entire database cluster of a running TimescaleDB database cluster. These are taken without affecting other clients to the database.

Full logical backup using pg_dumpall

From the Backup Ninja dashboard, go to Schedules → Add Schedule and follow the configuration wizard.

1) Details

  • Enter the name of the schedule: <strong>bkp_pgdumpall</strong>
  • Select a database server and the backup method to use: <strong>pg_dumpall</strong>
Note

Only installed backup tools on the selected server will be listed.

2) Storages

Where the backup will be stored. Select Add New Storage → Add Local Storage:

  • Add a storage name: <strong>local_storage</strong>
  • Specify a local storage directory: <strong>/backups/</strong>
  • And a retention policy: <strong>Days - 7</strong>
Note

You can also store the backup on a cloud provider using the cloud storage option.

3) Settings

Specify the name pattern to use for the backup files.

%B - YYYY-MM-DD_HHmmss
%D - database name (schema)
%H - server hostname
%I - backup job number
%M - backup method used

You can use compression (Gzip by default) and encryption (AES 256-bit OFB by default). If you enable encryption, a new window with the encryption key will be shown:

Note

You will need the encryption key to restore the backup, so make sure you save the key in a secure place.

4) Schedule

When the backup will be executed.

Full physical backup using pg_basebackup

From the Backup Ninja dashboard, go to Schedules → Add Schedule and follow the configuration wizard:

1) Details

  • Enter the name of the schedule: <strong>bkp_pgbasebackup</strong>
  • Select a database server and the backup method to use: <strong>pg_basebackup</strong>
Note

Only installed backup tools on the selected server will be listed.

2) Storages

Where the backup will be stored. Select Add New Storage → Add Local Storage:

  • Add a storage name: <strong>local_storage</strong>
  • Specify a local storage directory: <strong>/backups/</strong>
  • And a retention policy: <strong>Days - 7</strong>
Note

You can also store the backup on supported cloud storage by adding the cloud storage option.

3) Settings

Specify the name pattern to use for the backup files:

%B - YYYY-MM-DD_HHmmss
%D - database name (schema)
%H - server hostname
%I - backup job number
%M - backup method used

You can use compression (Gzip by default) and encryption (AES 256-bit OFB by default). If you enable encryption, a new window with the encryption key will be shown:

Note

You will need the encryption key to restore the backup, so make sure you save the key in a secure place.

]

4) Schedule

Schedule when the backup will be executed:

Note

Backups will be scheduled to run based on the database servers timezone setting.

Was this article helpful to you? Yes No