pgbackrest1
Reliable postgresql backup & restore
Usage
pgbackrest [options]
[command]
Overview
pgBackRest is a reliable backup and restore solution for PostgreSQL that seamlessly scales up to the largest databases and workloads.
Commands
annotate-
Add or modify backup annotation.
archive-get-
Get a WAL segment from the archive.
archive-push-
Push a WAL segment to the archive.
backup-
Backup a database cluster.
check-
Check the configuration.
expire-
Expire backups that exceed retention.
help-
Get help.
info-
Retrieve information about backups.
repo-get-
Get a file from a repository.
repo-ls-
List files in a repository.
restore-
Restore a database cluster.
server-
pgBackRest server.
server-ping-
Ping pgBackRest server.
stanza-create-
Create the required stanza data.
stanza-delete-
Delete a stanza.
stanza-upgrade-
Upgrade a stanza.
start-
Allow pgBackRest processes to run.
stop-
Stop pgBackRest processes from running.
verify-
Verify contents of a repository.
version-
Get version.
Options
Annotate Options:
-
--set -
Backup set to annotate.
Archive Options:
-
--archive-async -
Push/get WAL segments asynchronously.
-
--archive-get-queue-max -
Maximum size of the pgBackRest archive-get queue.
-
--archive-missing-retry -
Retry missing WAL segment
-
--archive-push-queue-max -
Maximum size of the PostgreSQL archive
queue.
-
--archive-timeout -
Archive timeout.
Backup Options:
-
--annotation -
Annotate backup with user-defined key/value pairs.
-
--archive-check -
Check that WAL segments are in the archive before backup completes.
-
--archive-copy -
Copy WAL segments needed for consistency to the backup.
-
--archive-mode-check -
Check the PostgreSQL archive_mode
setting.
-
--backup-standby -
Backup from the standby cluster.
-
--checksum-page -
Validate data page checksums.
-
--exclude -
Exclude paths/files from the backup.
-
--expire-auto -
Automatically run the expire command after a successful backup.
-
--force -
Force an offline backup.
-
--manifest-save-threshold -
Manifest save threshold during backup.
-
--online -
Perform an online backup.
-
--resume -
Allow resume of failed backup.
-
--start-fast -
Force a checkpoint to start backup
quickly.
-
--stop-auto -
Stop prior failed backup on new backup.
-
--type -
Backup type.
Expire Options:
-
--set -
Backup set to expire.
General Options:
-
--buffer-size -
Buffer size for I/O operations.
-
--cmd -
pgBackRest command.
-
--cmd-ssh -
SSH client command.
-
--compress -
Use file compression.
-
--compress-level -
File compression level.
-
--compress-level-network -
Network compression level.
-
--compress-type -
File compression type.
-
--config -
pgBackRest configuration file.
-
--config-include-path -
Path to additional pgBackRest configuration files.
-
--config-path -
Base path of pgBackRest configuration
files.
-
--db-timeout -
Database query timeout.
-
--delta -
Restore or backup using checksums.
-
--dry-run -
Execute a dry-run for the command.
-
--io-timeout -
I/O timeout.
-
--lock-path -
Path where lock files are stored.
-
--neutral-umask -
Use a neutral umask.
-
--process-max -
Max processes to use for
compress/transfer.
-
--protocol-timeout -
Protocol timeout.
-
--raw -
Do not transform data.
-
--sck-keep-alive -
Keep-alive enable.
-
--spool-path -
Path where transient data is stored.
-
--stanza -
Defines the stanza.
-
--tcp-keep-alive-count -
Keep-alive count.
-
--tcp-keep-alive-idle -
Keep-alive idle time.
-
--tcp-keep-alive-interval -
Keep-alive interval time.
Help Options:
-
--help -
Display help.
-
--version -
Display version.
Info Options:
-
--output -
Output format.
-
--set -
Backup set to detail.
-
--type -
Filter on backup type.
Log Options:
-
--log-level-console -
Level for console logging.
-
--log-level-file -
Level for file logging.
-
--log-level-stderr -
Level for stderr logging.
-
--log-path -
Path where log files are stored.
-
--log-subprocess -
Enable logging in subprocesses.
-
--log-timestamp -
Enable timestamp in logging.
Maintainer Options:
-
--archive-header-check -
Check PostgreSQL version/id in WAL
headers.
-
--page-header-check -
Check PostgreSQL page headers.
-
--pg-version-force -
Force PostgreSQL version.
Repo-get Options:
-
--ignore-missing -
Ignore missing source file.
Repo-ls Options:
-
--filter -
Filter output with a regular expression.
-
--output -
Output format.
-
--recurse -
Include all subpaths in output.
-
--sort -
Sort output ascending, descending, or
none.
Repository Options:
-
--repo -
Set repository.
-
--repo-azure-account -
Azure repository account.
-
--repo-azure-container -
Azure repository container.
-
--repo-azure-endpoint -
Azure repository endpoint.
-
--repo-azure-key -
Azure repository key.
-
--repo-azure-key-type -
Azure repository key type.
-
--repo-azure-uri-style -
Azure URI Style.
-
--repo-block -
Enable block incremental backup.
-
--repo-bundle -
Bundle files in repository.
-
--repo-bundle-limit -
Limit for file bundles.
-
--repo-bundle-size -
Target size for file bundles.
-
--repo-cipher-pass -
Repository cipher passphrase.
-
--repo-cipher-type -
Cipher used to encrypt the repository.
-
--repo-gcs-bucket -
GCS repository bucket.
-
--repo-gcs-endpoint -
GCS repository endpoint.
-
--repo-gcs-key -
GCS repository key.
-
--repo-gcs-key-type -
GCS repository key type.
-
--repo-gcs-user-project -
GCS project ID.
-
--repo-hardlink -
Hardlink files between backups in the
repository.
-
--repo-host -
Repository host when operating remotely.
-
--repo-host-ca-file -
Repository host certificate authority
file.
-
--repo-host-ca-path -
Repository host certificate authority
path.
-
--repo-host-cert-file -
Repository host certificate file.
-
--repo-host-cmd -
Repository host pgBackRest command.
-
--repo-host-config -
pgBackRest repository host configuration file.
-
--repo-host-config-include-path -
pgBackRest repository host configuration include path.
-
--repo-host-config-path -
pgBackRest repository host configuration path.
-
--repo-host-key-file -
Repository host key file.
-
--repo-host-port -
Repository host port when repo-host is
set.
-
--repo-host-type -
Repository host protocol type.
-
--repo-host-user -
Repository host user when repo-host is
set.
-
--repo-path -
Path where backups and archive are
stored.
-
--repo-retention-archive -
Number of backups worth of continuous WAL to retain.
-
--repo-retention-archive-type -
Backup type for WAL retention.
-
--repo-retention-diff -
Number of differential backups to
retain.
-
--repo-retention-full -
Full backup retention count/time.
-
--repo-retention-full-type -
Retention type for full backups.
-
--repo-retention-history -
Days of backup history manifests to
retain.
-
--repo-s3-bucket -
S3 repository bucket.
-
--repo-s3-endpoint -
S3 repository endpoint.
-
--repo-s3-key -
S3 repository access key.
-
--repo-s3-key-secret -
S3 repository secret access key.
-
--repo-s3-key-type -
S3 repository key type.
-
--repo-s3-kms-key-id -
S3 repository KMS key.
-
--repo-s3-region -
S3 repository region.
-
--repo-s3-requester-pays -
S3 repository requester pays.
-
--repo-s3-role -
S3 repository role.
-
--repo-s3-sse-customer-key -
S3 repository SSE customer key.
-
--repo-s3-token -
S3 repository security token.
-
--repo-s3-uri-style -
S3 URI Style.
-
--repo-sftp-host -
SFTP repository host.
-
--repo-sftp-host-fingerprint -
SFTP repository host fingerprint.
-
--repo-sftp-host-key-check-type -
SFTP host key check type.
-
--repo-sftp-host-key-hash-type -
SFTP repository host key hash type.
-
--repo-sftp-host-port -
SFTP repository host port.
-
--repo-sftp-host-user -
SFTP repository host user.
-
--repo-sftp-known-host -
SFTP known hosts file.
-
--repo-sftp-private-key-file -
SFTP private key file.
-
--repo-sftp-private-key-passphrase -
SFTP private key passphrase.
-
--repo-sftp-public-key-file -
SFTP public key file.
-
--repo-storage-ca-file -
Repository storage CA file.
-
--repo-storage-ca-path -
Repository storage CA path.
-
--repo-storage-host -
Repository storage host.
-
--repo-storage-port -
Repository storage port.
-
--repo-storage-tag -
Repository storage tag(s).
-
--repo-storage-upload-chunk-size -
Repository storage upload chunk size.
-
--repo-storage-verify-tls -
Repository storage certificate verify.
-
--repo-target-time -
Target time for repository.
-
--repo-type -
Type of storage used for the repository.
Restore Options:
-
--archive-mode -
Preserve or disable archiving on restored cluster.
-
--db-exclude -
Restore excluding the specified
databases.
-
--db-include -
Restore only specified databases.
-
--force -
Force a restore.
-
--link-all -
Restore all symlinks.
-
--link-map -
Modify the destination of a symlink.
-
--recovery-option -
Set an option in postgresql.auto.conf or recovery.conf.
-
--set -
Backup set to restore.
-
--tablespace-map -
Restore a tablespace into the specified
directory.
-
--tablespace-map-all -
Restore all tablespaces into the specified directory.
-
--target -
Recovery target.
-
--target-action -
Action to take when recovery target is
reached.
-
--target-exclusive -
Stop just before the recovery target is
reached.
-
--target-timeline -
Recover along a timeline.
-
--type -
Recovery type.
Server Options:
-
--tls-server-address -
TLS server address.
-
--tls-server-auth -
TLS server authorized clients.
-
--tls-server-ca-file -
TLS server certificate authorities.
-
--tls-server-cert-file -
TLS server certificate file.
-
--tls-server-key-file -
TLS server key file.
-
--tls-server-port -
TLS server port.
Stanza Options:
-
--pg-database -
PostgreSQL database.
-
--pg-host -
PostgreSQL host for operating remotely.
-
--pg-host-ca-file -
PostgreSQL host certificate authority
file.
-
--pg-host-ca-path -
PostgreSQL host certificate authority
path.
-
--pg-host-cert-file -
PostgreSQL host certificate file.
-
--pg-host-cmd -
PostgreSQL host pgBackRest command.
-
--pg-host-config -
pgBackRest database host configuration
file.
-
--pg-host-config-include-path -
pgBackRest database host configuration include path.
-
--pg-host-config-path -
pgBackRest database host configuration
path.
-
--pg-host-key-file -
PostgreSQL host key file.
-
--pg-host-port -
PostgreSQL host port when pg-host is
set.
-
--pg-host-type -
PostgreSQL host protocol type.
-
--pg-host-user -
PostgreSQL host logon user when pg-host is set.
-
--pg-path -
PostgreSQL data directory.
-
--pg-port -
PostgreSQL port.
-
--pg-socket-path -
PostgreSQL unix socket path.
-
--pg-user -
PostgreSQL database user.
Stanza-create Options:
-
--online -
Create on an online cluster.
Stanza-delete Options:
-
--force -
Force stanza delete.
Stanza-upgrade Options:
-
--online -
Update an online cluster.
Stop Options:
-
--force -
Force all pgBackRest processes to stop.
Verify Options:
-
--output -
Output type.
-
--set -
Backup set to verify.
-
--verbose -
Verbose output.
Version Options:
-
--output -
Output type.
Files
/etc/pgbackrest/pgbackrest.conf /var/lib/pgbackrest /var/log/pgbackrest /var/spool/pgbackrest /tmp/pgbackrest
Examples
- •
-
Create a backup of the PostgreSQL `main` cluster:
$ pgbackrest --stanza=main backup
The `main` cluster should be configured in `/etc/pgbackrest/pgbackrest.conf`
- •
-
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
History
- Debian 13 (Trixie): the text shown here
- Debian 12 (Bookworm)
- Debian 11 (Bullseye)
- Debian 10 (Buster)
- Debian 9 (Stretch)
--annotation since Debian 12 (Bookworm);
--archive-get-queue-max since Debian 10 (Buster);
--archive-header-check since Debian 11 (Bullseye);
--archive-missing-retry since Debian 12 (Bookworm);
--archive-mode since Debian 11 (Bullseye);
--archive-mode-check since Debian 11 (Bullseye);
--archive-push-queue-max since Debian 10 (Buster);
--cmd since Debian 12 (Bookworm);
--compress-type since Debian 11 (Bullseye);
--config-include-path since Debian 10 (Buster);
--config-path since Debian 10 (Buster);
--db-exclude since Debian 12 (Bookworm);
--dry-run since Debian 11 (Bullseye);
--exclude since Debian 10 (Buster);
--expire-auto since Debian 11 (Bullseye);
--filter since Debian 11 (Bullseye);
--help since Debian 13 (Trixie);
--ignore-missing since Debian 11 (Bullseye);
--io-timeout since Debian 11 (Bullseye);
--log-subprocess since Debian 10 (Buster);
--log-timestamp since Debian 10 (Buster);
--page-header-check since Debian 13 (Trixie);
--pg-database since Debian 11 (Bullseye);
--pg-host since Debian 10 (Buster);
--pg-host-ca-file since Debian 12 (Bookworm);
--pg-host-ca-path since Debian 12 (Bookworm);
--pg-host-cert-file since Debian 12 (Bookworm);
--pg-host-cmd since Debian 10 (Buster);
--pg-host-config since Debian 10 (Buster);
--pg-host-config-include-path since Debian 10 (Buster);
--pg-host-config-path since Debian 10 (Buster);
--pg-host-key-file since Debian 12 (Bookworm);
--pg-host-port since Debian 10 (Buster);
--pg-host-type since Debian 12 (Bookworm);
--pg-host-user since Debian 10 (Buster);
--pg-path since Debian 10 (Buster);
--pg-port since Debian 10 (Buster);
--pg-socket-path since Debian 10 (Buster);
--pg-user since Debian 11 (Bullseye);
--pg-version-force since Debian 13 (Trixie);
--raw since Debian 11 (Bullseye);
--recurse since Debian 11 (Bullseye);
--repo since Debian 11 (Bullseye);
--repo-azure-account since Debian 11 (Bullseye);
--repo-azure-container since Debian 11 (Bullseye);
--repo-azure-endpoint since Debian 11 (Bullseye);
--repo-azure-key since Debian 11 (Bullseye);
--repo-azure-key-type since Debian 11 (Bullseye);
--repo-azure-uri-style since Debian 12 (Bookworm);
--repo-block since Debian 12 (Bookworm);
--repo-bundle since Debian 12 (Bookworm);
--repo-bundle-limit since Debian 12 (Bookworm);
--repo-bundle-size since Debian 12 (Bookworm);
--repo-cipher-pass since Debian 10 (Buster);
--repo-cipher-type since Debian 10 (Buster);
--repo-gcs-bucket since Debian 11 (Bullseye);
--repo-gcs-endpoint since Debian 11 (Bullseye);
--repo-gcs-key since Debian 11 (Bullseye);
--repo-gcs-key-type since Debian 11 (Bullseye);
--repo-gcs-user-project since Debian 13 (Trixie);
--repo-hardlink since Debian 10 (Buster);
--repo-host since Debian 10 (Buster);
--repo-host-ca-file since Debian 12 (Bookworm);
--repo-host-ca-path since Debian 12 (Bookworm);
--repo-host-cert-file since Debian 12 (Bookworm);
--repo-host-cmd since Debian 10 (Buster);
--repo-host-config since Debian 10 (Buster);
--repo-host-config-include-path since Debian 10 (Buster);
--repo-host-config-path since Debian 10 (Buster);
--repo-host-key-file since Debian 12 (Bookworm);
--repo-host-port since Debian 10 (Buster);
--repo-host-type since Debian 12 (Bookworm);
--repo-host-user since Debian 10 (Buster);
--repo-retention-archive since Debian 10 (Buster);
--repo-retention-archive-type since Debian 10 (Buster);
--repo-retention-diff since Debian 10 (Buster);
--repo-retention-full since Debian 10 (Buster);
--repo-retention-full-type since Debian 11 (Bullseye);
--repo-retention-history since Debian 12 (Bookworm);
--repo-s3-bucket since Debian 10 (Buster);
--repo-s3-endpoint since Debian 10 (Buster);
--repo-s3-key since Debian 10 (Buster);
--repo-s3-key-secret since Debian 10 (Buster);
--repo-s3-key-type since Debian 11 (Bullseye);
--repo-s3-kms-key-id since Debian 12 (Bookworm);
--repo-s3-region since Debian 10 (Buster);
--repo-s3-requester-pays since Debian 13 (Trixie);
--repo-s3-role since Debian 11 (Bullseye);
--repo-s3-sse-customer-key since Debian 13 (Trixie);
--repo-s3-token since Debian 10 (Buster);
--repo-s3-uri-style since Debian 11 (Bullseye);
--repo-sftp-host since Debian 13 (Trixie);
--repo-sftp-host-fingerprint since Debian 13 (Trixie);
--repo-sftp-host-key-check-type since Debian 13 (Trixie);
--repo-sftp-host-key-hash-type since Debian 13 (Trixie);
--repo-sftp-host-port since Debian 13 (Trixie);
--repo-sftp-host-user since Debian 13 (Trixie);
--repo-sftp-known-host since Debian 13 (Trixie);
--repo-sftp-private-key-file since Debian 13 (Trixie);
--repo-sftp-private-key-passphrase since Debian 13 (Trixie);
--repo-sftp-public-key-file since Debian 13 (Trixie);
--repo-storage-ca-file since Debian 11 (Bullseye);
--repo-storage-ca-path since Debian 11 (Bullseye);
--repo-storage-host since Debian 11 (Bullseye);
--repo-storage-port since Debian 11 (Bullseye);
--repo-storage-tag since Debian 13 (Trixie);
--repo-storage-upload-chunk-size since Debian 12 (Bookworm);
--repo-storage-verify-tls since Debian 11 (Bullseye);
--repo-target-time since Debian 13 (Trixie);
--repo-type since Debian 10 (Buster);
--sck-keep-alive since Debian 11 (Bullseye);
--sort since Debian 11 (Bullseye);
--tcp-keep-alive-count since Debian 11 (Bullseye);
--tcp-keep-alive-idle since Debian 11 (Bullseye);
--tcp-keep-alive-interval since Debian 11 (Bullseye);
--tls-server-address since Debian 12 (Bookworm);
--tls-server-auth since Debian 12 (Bookworm);
--tls-server-ca-file since Debian 12 (Bookworm);
--tls-server-cert-file since Debian 12 (Bookworm);
--tls-server-key-file since Debian 12 (Bookworm);
--tls-server-port since Debian 12 (Bookworm);
--verbose since Debian 12 (Bookworm);
--version since Debian 13 (Trixie).
--archive-max-mb until Debian 9 (Stretch);
--backup-cmd until Debian 9 (Stretch);
--backup-config until Debian 9 (Stretch);
--backup-host until Debian 9 (Stretch);
--backup-user until Debian 9 (Stretch);
--db-cmd until Debian 9 (Stretch);
--db-config until Debian 9 (Stretch);
--db-host until Debian 9 (Stretch);
--db-path until Debian 9 (Stretch);
--db-port until Debian 9 (Stretch);
--db-socket-path until Debian 9 (Stretch);
--db-user until Debian 9 (Stretch);
--hardlink until Debian 9 (Stretch);
--lock until Debian 9 (Stretch);
--repo-block-age-map until Debian 12 (Bookworm);
--repo-block-checksum-size-map until Debian 12 (Bookworm);
--repo-block-size-map until Debian 12 (Bookworm);
--repo-block-size-super until Debian 12 (Bookworm);
--repo-block-size-super-full until Debian 12 (Bookworm);
--repo-link until Debian 9 (Stretch);
--repo-s3-ca-file until Debian 10 (Buster);
--repo-s3-ca-path until Debian 10 (Buster);
--repo-s3-host until Debian 10 (Buster);
--repo-s3-verify-ssl until Debian 10 (Buster);
--repo-sync until Debian 9 (Stretch);
--retention-archive until Debian 9 (Stretch);
--retention-archive-type until Debian 9 (Stretch);
--retention-diff until Debian 9 (Stretch);
--retention-full until Debian 9 (Stretch).