To create a backup, run the following command:
pg_probackup3 backup -Bbackup_dir--instance=instance_name-bbackup_mode-sbackup_source-ibackup_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.
The BASE and DIRECT backup data source modes do not support CFS.
The BASE backup data source mode supports only FULL and DELTA backup modes.
Some options can be skipped depending on the user goals:
If backup_mode is not specified, the
FULL mode
is used by default.
PRO is the
default value for backup_source.
If the backup ID is not specified explicitly in the body of a request,
backup_id will take the value
of the date and time it was created.
If the backup ID is specified and includes a
path to a directory, backup_dir and
instance_name can be skipped
without specification. Example: -i /mnt/ramdisk/backups/2.backup.
If a path to the data directory is not specified either via
backup_dir or via --backup-id,
the current directory will be used as the default one.
If you omit the parent backup ID when performing incremental backups, pg_probackup3 will use the latest valid backup from the backup chain. If pg_probackup3 somehow fails to find it, the backup process will conclude with an error.
If the
--from-full
parameter is specified, an incremental backup will be created from
the last FULL backup.
ARCHIVE is the default WAL delivery mode.
To make a FULL backup in the ARCHIVE mode, run:
pg_probackup3 backup -Bbackup_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.
To make a FULL backup in the STREAM mode, add the
--stream flag to the command from the
previous example:
pg_probackup3 backup -Bbackup_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.
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 -Bbackup_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 -Bbackup_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.
External directories are not supported in the BASE mode.