Performing PITR and making backups with the ARCHIVE WAL delivery mode require continuous WAL archiving to be enabled. To set up continuous archiving in the cluster, complete the following steps:
Make sure the
wal_level
parameter is higher than minimal.
If you are configuring archiving on the primary,
archive_mode
must be set to on or
always.
Set the archive_command parameter, as follows:
archive_command = '"install_dir/pg_probackup3" archive-push -B "backup_dir" --instance=instance_name--wal-file-name=%f [ssh_options]'
where install_dir is the
installation directory of the pg_probackup3
version you are going to use, backup_dir and
instance_name refer to the already
initialized backup catalog instance for this database cluster,
and SSH options
only need to be specified to archive WAL on a remote host. For details about all
possible archive-push parameters, see the
section archive-push.
The --wal-file-path option provides the path to the WAL
file used by the archive-push command.
This path can be absolute or relative. An absolute path is used as-is. A
relative path is interpreted relative to the current working directory.
When invoked via archive_command, Postgres Pro
sets the current working directory to PGDATA, so relative
paths like pg_wal/... work correctly:
archive_command = 'pg_probackup3 archive-push -B /backup --instance=main --wal-file-path=%p --wal-file-name=%f'
If --wal-file-path is omitted, pg_wal
relative to the current working directory is used:
archive_command = 'pg_probackup3 archive-push -B /backup --instance=main --wal-file-name=%f'
When used in restore_command, Postgres Pro
substitutes the %p variable for the full path and
%f for the file name before calling
pg_probackup3, regardless of whether the path
is absolute or relative.
Before starting the Postgres Pro server, you can
verify that WAL is correctly sent to the archive by running the
archive-push command manually from PGDATA:
cd /var/lib/pgsql/data pg_probackup3 archive-push -B /backup --instance=main --wal-file-path=pg_wal/000000010000000000000001 --wal-file-name=000000010000000000000001
Once these steps are complete, you can start making backups in the ARCHIVE WAL mode as well as perform PITR.
You can view the current state of the WAL archive using the show command. For details, see Section 3.3.2.
Instead of using the archive-push
command provided by pg_probackup3, you can use
any other tool to set up continuous archiving as long as it delivers WAL segments into
directory. If compression is used, it should be
backup_dir/wal/instance_namegzip, and .gz suffix in filename is
mandatory.
Instead of configuring continuous archiving by setting the
archive_mode and archive_command
parameters, you can opt for using the
pg_receivewal
utility. In this case, pg_receivewal -D
option should point to
directory
directory. pg_probackup3 supports WAL compression
that can be done by pg_receivewal.
“Zero Data Loss” archive strategy can be
achieved only by using pg_receivewal.
backup_dir/wal/instance_name