3.2. Setting up STREAM Backups #

To set up the cluster for STREAM backups, complete the following steps:

  • If the backup role does not exist, create it with the REPLICATION attribute when configuring the database cluster:

    CREATE ROLE backup WITH LOGIN REPLICATION;
    
  • If the backup role already exists, add the REPLICATION attribute to it:

    ALTER ROLE backup WITH REPLICATION;
    
  • In the pg_hba.conf file, allow replication on behalf of the backup role.

  • Make sure the max_wal_senders server parameter is set to a value high enough to leave at least one session for the backup process.

  • Set the wal_level server parameter to a value 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 delivery mode.

Note

If you are planning to rely on .pgpass for authentication when running backup in STREAM mode, then the .pgpass file must contain credentials for the replication database used to establish connection via a replication protocol, for example, pghost:5432:replication:backup_user:my_strong_password.pgpass.

FAQ