← cyphonix.comSign in to the console
Cyphonix Backup

Home › Documentation › Agents › PostgreSQL

PostgreSQL

Applies to PostgreSQL 13 to 17 on Linux. PostgreSQL on Windows is supported for logical backups only. Requires the Server plan.

Two methods

LogicalPhysical
Mechanismpg_dump per databaseBase backup plus WAL archiving
Point-in-time restoreNoYes
Restore to a different major versionYesNo
Suitable forDatabases up to about 200 GBAny size
Default scheduleDailyWeekly base backup, continuous WAL

Logical backups

sudo cbk config set postgresql.enabled true
sudo cbk config set postgresql.method logical
sudo cbk postgresql select --all

The agent connects over the local socket as the postgres operating system user. Roles and tablespaces are captured with pg_dumpall --globals-only alongside each run.

Physical backups

sudo cbk config set postgresql.method physical

Then add to postgresql.conf and reload:

archive_mode = on
archive_command = 'cbk postgresql archive-wal %p'
wal_level = replica

Changing archive_mode requires a restart of PostgreSQL. The agent takes a base backup weekly and uploads each WAL segment as it is completed. If the agent cannot upload, segments accumulate in pg_wal; monitor free space.

Replicas

Base backups can be taken from a streaming replica to reduce load on the primary. WAL archiving must be configured on whichever server is the primary.

Restoring

See Database restore.

Exclude the data directory from file backup

If the server also has file-level sources, exclude the PostgreSQL data directory (for example /var/lib/postgresql). A file-level copy of a running cluster is not a usable backup.

Known issue

The "transferred" figure for PostgreSQL jobs shows the size before compression. See Known issues.

Last reviewed: · Report a problem with this page