The postgresql.conf file
For the postgresql.conf
file, we have to set wal_level
to replica
or logical
. It is important that the WAL level is not set to minimal
, because PITR is not possible if wal_level=minimal
. We also need to tell PostgreSQL the command that will send the WAL segment to the pgbackrest
repository server.
Let’s add these lines at the end of the postgresql.conf
file:
#PGBACKREST
archive_mode = on
wal_level = replica #logical if we have some logical replications
archive_command = 'pgbackrest --stanza=pg1 archive-push %p'
With the second line, we say to PostgreSQL that the WAL segments will be archived on the pg1
stanza of the repository server using the pgbackrest
command. After restarting PostgreSQL, these new lines will be available. As the root
user, let’s perform a restart of the PostgreSQL service:
# systemctl restart postgresql