Scroll to navigation

pgbackrest(1) pgBackRest Command Reference pgbackrest(1)

NAME

pgBackRest - Reliable PostgreSQL Backup & Restore

SYNOPSIS

pgbackrest [options] [command]

DESCRIPTION

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.

COMMANDS

Add or modify backup annotation.
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.
pgBackRest server.
Ping pgBackRest server.
Create the required stanza data.
Delete a stanza.
Upgrade a stanza.
Allow pgBackRest processes to run.
Stop pgBackRest processes from running.
Verify contents of the repository.
Get version.

OPTIONS

Annotate Options:

Backup set to annotate.

Archive Options:

Push/get WAL segments asynchronously. [default=n]
Maximum size of the pgBackRest archive-get queue. [default=128MiB]
Check PostgreSQL version/id in WAL headers. [default=y]
Retry missing WAL segment [default=y]
Maximum size of the PostgreSQL archive queue.
Archive timeout. [default=60]

Backup Options:

Annotate backup with user-defined key/value pairs.
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 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=1GiB]
Perform an online backup. [default=y]
Check PostgreSQL page headers. [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 I/O operations. [default=1MiB]
pgBackRest command.
SSH client command. [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 "/" PROJECT_CONFIG_FILE]
Path to additional pgBackRest configuration files. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_INCLUDE_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.
Filter on backup type.

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. [default=blob.core.windows.net]
Azure repository key.
Azure repository key type. [default=shared]
Azure URI Style. [default=host]
Enable block incremental backup. [default=n]
Bundle files in repository. [default=n]
Limit for file bundles. [default=2MiB]
Target size for file bundles. [default=20MiB]
Repository cipher passphrase.
Cipher used to encrypt the repository. [default=none]
GCS repository bucket.
GCS repository endpoint. [default=storage.googleapis.com]
GCS repository key.
GCS repository key type. [default=service]
Hardlink files between backups in the repository. [default=n]
Repository host when operating remotely.
Repository host certificate authority file.
Repository host certificate authority path.
Repository host certificate file.
Repository host pgBackRest command.
pgBackRest repository host configuration file. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_FILE]
pgBackRest repository host configuration include path. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_INCLUDE_PATH]
pgBackRest repository host configuration path. [default=CFGOPTDEF_CONFIG_PATH]
Repository host key file.
Repository host port when repo-host is set.
Repository host protocol type. [default=ssh]
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 KMS key.
S3 repository region.
S3 repository role.
S3 repository security token.
S3 URI Style. [default=host]
SFTP repository host.
SFTP repository host fingerprint.
SFTP repository host key hash type.
SFTP repository host port. [default=22]
SFTP repository host user.
SFTP private key file.
SFTP private key passphrase.
SFTP public key file.
Repository storage CA file.
Repository storage CA path.
Repository storage host.
Repository storage port. [default=443]
Repository storage upload chunk size.
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]

Server Options:

TLS server address. [default=localhost]
TLS server authorized clients.
TLS server certificate authorities.
TLS server certificate file.
TLS server key file.
TLS server port. [default=8432]

Stanza Options:

PostgreSQL database. [default=postgres]
PostgreSQL host for operating remotely.
PostgreSQL host certificate authority file.
PostgreSQL host certificate authority path.
PostgreSQL host certificate file.
PostgreSQL host pgBackRest command.
pgBackRest database host configuration file. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_FILE]
pgBackRest database host configuration include path. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_INCLUDE_PATH]
pgBackRest database host configuration path. [default=CFGOPTDEF_CONFIG_PATH]
PostgreSQL host key file.
PostgreSQL host port when pg-host is set.
PostgreSQL host protocol type. [default=ssh]
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:

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]

Verify Options:

Output type. [default=none]
Verbose output. [default=n]

FILES

CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_FILE /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 `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

SEE ALSO

/usr/share/doc/pgbackrest-doc/html/index.html http://www.pgbackrest.org

02 June 2023