3.1. Creating a Backup #

3.1.1. ARCHIVE Mode
3.1.2. STREAM Mode
3.1.3. External Directories

To create a backup, run the following command:

pg_probackup3 backup -B backup_dir --instance=instance_name -b backup_mode -s backup_source -i backup_id

Where backup_mode can take one of the following values: FULL, DELTA, and PTRACK.

And backup_source can take one of these: DIRECT, BASE, and PRO.

Warning

The BASE and DIRECT backup data source modes do not support CFS.

Note

The BASE backup data source mode supports only FULL and DELTA backup modes.

Some options can be skipped depending on the user goals:

3.1.1. ARCHIVE Mode #

ARCHIVE is the default WAL delivery mode.

To make a FULL backup in the ARCHIVE mode, run:

pg_probackup3 backup -B backup_dir --instance=instance_name -b FULL

ARCHIVE backups rely on continuous archiving to get WAL segments required to restore the cluster to a consistent state at the time the backup was taken.

3.1.2. STREAM Mode #

To make a FULL backup in the STREAM mode, add the --stream flag to the command from the previous example:

pg_probackup3 backup -B backup_dir --instance=instance_name -b FULL --stream

Unlike backups in the ARCHIVE mode, STREAM backups include all the WAL segments required to restore the cluster to a consistent state at the time the backup was taken.

During backup pg_probackup3 streams WAL files containing WAL records between Start LSN and Stop LSN to the backup file.

Even if you are using continuous archiving, STREAM backups can still be useful in the following cases:

  • STREAM backups can be restored on the server that has no file access to WAL archive.

  • STREAM backups enable you to restore the cluster state at the point in time for which WAL files in archive are no longer available.

3.1.3. External Directories #

To back up a directory located outside of the data directory, use the optional --external-dirs parameter that specifies the path to this directory. If you would like to add more than one external directory, you can provide several paths separated by colons on Linux systems.

For example, to include /etc/dir1 and /etc/dir2 directories into the full backup of your instance_name instance that will be stored under the backup_dir directory on Linux, run:

pg_probackup3 backup -B backup_dir --instance=instance_name -b FULL --external-dirs=/etc/dir1:/etc/dir2

Similarly, to include C:\dir1 and C:\dir2 directories into the full backup on Windows, run:

pg_probackup3 backup -B backup_dir --instance=instance_name -b FULL --external-dirs=C:\dir1;C:\dir2

pg_probackup3 recursively copies the contents of each external directory into a separate subdirectory in the backup catalog. Since external directories included into different backups do not have to be the same, when you are restoring the cluster from an incremental backup, only those directories that belong to this particular backup will be restored. Any external directories stored in the previous backups will be ignored.

To include the same directories into each backup of your instance, you can specify them in the pg_probackup3.conf configuration file using the set-config command with the --external-dirs option.

Note

External directories are not supported in the BASE mode.