To set up the cluster for STREAM backups, complete the following steps:
If the backup role does not exist, create it with
the REPLICATION privilege when
Configuring the
Database Cluster:
CREATE ROLE backup WITH LOGIN REPLICATION;
If the backup role already exists, grant it with the REPLICATION privilege:
ALTER ROLE backup WITH REPLICATION;
In the
pg_hba.conf
file, allow replication on behalf of the
backup role.
Make sure the parameter max_wal_senders is set high enough to leave at least one session available for the backup process.
Set the parameter
wal_level
to be higher than minimal.
If you are planning to perform PITR with STREAM backups, you still have to configure WAL archiving, as explained in the section Setting up continuous WAL archiving.
Once these steps are complete, you can start taking FULL, DELTA, and PTRACK backups in the STREAM WAL mode.
If you are planning to rely on
.pgpass
for authentication when running backup in STREAM mode,
then .pgpass must contain credentials for replication
database, used to establish connection via replication protocol.
Example: pghost:5432:replication:backup_user:my_strong_password