Scroll to navigation

pgbackrest(1) pgBackRest Command Reference pgbackrest(1)


pgBackRest - Reliable PostgreSQL Backup & Restore


pgbackrest [options] [command]


pgBackRest aims to be a reliable, easy-to-use backup and restore solution that can seamlessly scale up to the largest databases and workloads by utilizing algorithms that are optimized for database-specific requirements.


Get a WAL segment from the archive.
Push a WAL segment to the archive.
Backup a database cluster.
Check the configuration.
Expire backups that exceed retention.
Get help.
Retrieve information about backups.
Get a file from a repository.
List files in a repository.
Restore a database cluster.
Create the required stanza data.
Delete a stanza.
Upgrade a stanza.
Allow pgBackRest processes to run.
Stop pgBackRest processes from running.
Get version.


Archive Options:

Push/get WAL segments asynchronously. [default=n]
Maximum size of the pgBackRest archive-get queue. [default=134217728]
Maximum size of the PostgreSQL archive queue.
Archive timeout. [default=60]

Backup Options:

Check that WAL segments are in the archive before backup completes. [default=y]
Copy WAL segments needed for consistency to the backup. [default=n]
Check PostgreSQL version/id in WAL headers. [default=y]
Check the PostgreSQL archive_mode setting. [default=y]
Backup from the standby cluster. [default=n]
Validate data page checksums.
Exclude paths/files from the backup.
Automatically run the expire command after a successful backup. [default=y]
Force an offline backup. [default=n]
Manifest save threshold during backup. [default=1073741824]
Perform an online backup. [default=y]
Allow resume of failed backup. [default=y]
Force a checkpoint to start backup quickly. [default=n]
Stop prior failed backup on new backup. [default=n]
Backup type. [default=incr]

Expire Options:

Backup set to expire.

General Options:

Buffer size for file operations. [default=1048576]
Path to ssh client executable. [default=ssh]
Use file compression. [default=y]
File compression level.
Network compression level. [default=3]
File compression type. [default=gz]
pgBackRest configuration file. [default=CFGOPTDEF_CONFIG_PATH "/"


Path to additional pgBackRest configuration files. [default=CFGOPTDEF_CONFIG_PATH "/"


Base path of pgBackRest configuration files. [default=CFGOPTDEF_CONFIG_PATH]
Database query timeout. [default=1800]
Restore or backup using checksums. [default=n]
Execute a dry-run for the command. [default=n]
I/O timeout. [default=60]
Path where lock files are stored. [default=/tmp/pgbackrest]
Use a neutral umask. [default=y]
Max processes to use for compress/transfer. [default=1]
Protocol timeout. [default=1830]
Do not transform data. [default=n]
Keep-alive enable. [default=y]
Path where transient data is stored. [default=/var/spool/pgbackrest]
Defines the stanza.
Keep-alive count.
Keep-alive idle time.
Keep-alive interval time.

Info Options:

Output format. [default=text]
Backup set to detail.

Log Options:

Level for console logging. [default=warn]
Level for file logging. [default=info]
Level for stderr logging. [default=warn]
Path where log files are stored. [default=/var/log/pgbackrest]
Enable logging in subprocesses. [default=n]
Enable timestamp in logging. [default=y]

Repo-get Options:

Ignore missing source file. [default=n]

Repo-ls Options:

Filter output with a regular expression.
Output format. [default=text]
Include all subpaths in output. [default=n]
Sort output ascending, descending, or none. [default=asc]

Repository Options:

Set repository.
Azure repository account.
Azure repository container.
Azure repository endpoint. []
Azure repository key.
Azure repository key type. [default=shared]
Repository cipher passphrase.
Cipher used to encrypt the repository. [default=none]
GCS repository bucket.
GCS repository endpoint. []
GCS repository key.
GCS repository key type. [default=service]
Hardlink files between backups in the repository. [default=n]
Repository host when operating remotely via SSH.
pgBackRest exe path on the repository host.
pgBackRest repository host configuration file. [default=CFGOPTDEF_CONFIG_PATH "/"


pgBackRest repository host configuration include path. [default=CFGOPTDEF_CONFIG_PATH "/"


pgBackRest repository host configuration path. [default=CFGOPTDEF_CONFIG_PATH]
Repository host port when repo-host is set.
Repository host user when repo-host is set. [default=pgbackrest]
Path where backups and archive are stored. [default=/var/lib/pgbackrest]
Number of backups worth of continuous WAL to retain.
Backup type for WAL retention. [default=full]
Number of differential backups to retain.
Full backup retention count/time.
Retention type for full backups. [default=count]
Days of backup history manifests to retain.
S3 repository bucket.
S3 repository endpoint.
S3 repository access key.
S3 repository secret access key.
S3 repository key type. [default=shared]
S3 repository region.
S3 repository role.
S3 repository security token.
S3 URI Style. [default=host]
Repository storage CA file.
Repository storage CA path.
Repository storage host.
Repository storage port. [default=443]
Repository storage certificate verify. [default=y]
Type of storage used for the repository. [default=posix]

Restore Options:

Preserve or disable archiving on restored cluster. [default=preserve]
Restore excluding the specified databases.
Restore only specified databases.
Force a restore. [default=n]
Restore all symlinks. [default=n]
Modify the destination of a symlink.
Set an option in recovery.conf.
Backup set to restore. [default=latest]
Restore a tablespace into the specified directory.
Restore all tablespaces into the specified directory.
Recovery target.
Action to take when recovery target is reached. [default=pause]
Stop just before the recovery target is reached. [default=n]
Recover along a timeline.
Recovery type. [default=default]

Stanza Options:

PostgreSQL database. [default=postgres]
PostgreSQL host for operating remotely via SSH.
pgBackRest exe path on the PostgreSQL host.
pgBackRest database host configuration file. [default=CFGOPTDEF_CONFIG_PATH "/"


pgBackRest database host configuration include path. [default=CFGOPTDEF_CONFIG_PATH "/"


pgBackRest database host configuration path. [default=CFGOPTDEF_CONFIG_PATH]
PostgreSQL host port when pg-host is set.
PostgreSQL host logon user when pg-host is set. [default=postgres]
PostgreSQL data directory.
PostgreSQL port. [default=5432]
PostgreSQL unix socket path.
PostgreSQL database user.

Stanza-create Options:

Force stanza creation. [default=n]
Create on an online cluster. [default=y]

Stanza-delete Options:

Force stanza delete. [default=n]

Stanza-upgrade Options:

Update an online cluster. [default=y]

Stop Options:

Force all pgBackRest processes to stop. [default=n]



/var/lib/pgbackrest /var/log/pgbackrest /var/spool/pgbackrest /tmp/pgbackrest


Create a backup of the PostgreSQL `main` cluster:

$ pgbackrest --stanza=main backup
The `main` cluster should be configured in `CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_FILE`
Show all available backups:

$ pgbackrest info
Show all available backups for a specific cluster:

$ pgbackrest --stanza=main info
Show backup specific options:

$ pgbackrest help backup



14 June 2021