{[project]} Command & Configuration Reference

{[project]} Configuration Reference

The {[project]} Configuration Reference details all configuration options.
can be used entirely with command-line parameters but a configuration file is more practical for installations that are complex or set a lot of options. The default location for the configuration file is /etc/pgbackrest/pgbackrest.conf. If no file exists in that location then the old default of /etc/pgbackrest.conf will be checked.

Settings

The log section defines logging-related settings.Trace-level logging may expose secrets such as keys and passwords. Use with caution!
Level for file logging.
The following log levels are supported:

- off
  - No logging at all (not recommended)
- error
  - Log only errors
- warn
  - Log warnings and errors
- info
  - Log info, warnings, and errors
- detail
  - Log detail, info, warnings, and errors
- debug
  - Log debug, detail, info, warnings, and errors
- trace
  - Log trace (very verbose debugging), debug, info, warnings, and errors

debug
Level for console logging.
The following log levels are supported:

- off
  - No logging at all (not recommended)
- error
  - Log only errors
- warn
  - Log warnings and errors
- info
  - Log info, warnings, and errors
- detail
  - Log detail, info, warnings, and errors
- debug
  - Log debug, detail, info, warnings, and errors
- trace
  - Log trace (very verbose debugging), debug, info, warnings, and errors

error
Level for stderr logging.
Specifies which log levels will output to stderr rather than stdout (specified by log-level-console). The timestamp and process will not be output to stderr.

The following log levels are supported:

- off
  - No logging at all (not recommended)
- error
  - Log only errors
- warn
  - Log warnings and errors
- info
  - Log info, warnings, and errors
- detail
  - Log detail, info, warnings, and errors
- debug
  - Log debug, detail, info, warnings, and errors
- trace
  - Log trace (very verbose debugging), debug, info, warnings, and errors

error
Path where log files are stored.
The log path provides a location for to store log files. Note that if log-level-file=off then no log path is required.
/backup/db/log
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
n
Enable logging in subprocesses.
Enable file logging for any subprocesses created by this process using the log level specified by log-level-file.
y
The general section defines options that are common for many commands.
Buffer size for file operations.
Set the buffer size used for copy, compress, and uncompress functions. A maximum of 3 buffers will be in use at a time per process. An additional maximum of 256K per process may be used for zlib buffers.

Size can be entered in bytes (default) or KB, MB, GB, TB, or PB where the multiplier is a power of 1024. For example, the case-insensitive value 32k (or 32KB) can be used instead of 32768.

Allowed values, in bytes, are 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, and 16777216.
32K
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
/usr/bin/ssh
Use file compression.
Backup files are compatible with command-line compression tools.

This option is now deprecated. The compress-type option should be used instead.
n
File compression type.
The following compression types are supported:

- gz
  - gzip compression format
- lz4
  - lz4 compression format (not available on all platforms)

n
File compression level.
Sets the level to be used for file compression when compress-type does not equal none or compress=y (deprecated).
0-9
9
Network compression level.
Sets the network compression level when compress-type=none and the command is not run on the same host as the repository. Compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress-type does not equal none the compress-level-network setting is ignored and compress-level is used instead so that the file is only compressed once. SSH compression is always disabled.
0-9
1
Database query timeout.
Sets the timeout, in seconds, for queries against the database. This includes the `pg_start_backup()` and `pg_stop_backup()` functions which can each take a substantial amount of time. Because of this the timeout should be kept high unless you know that these functions will return quickly (i.e. if you have set startfast=y and you know that the database cluster will not generate many WAL segments during the backup). The db-timeout option must be less than the protocol-timeout option.
600
Restore or backup using checksums.
During a restore, by default the data and tablespace directories are expected to be present but empty. This option performs a delta restore using checksums.

During a backup, this option will use checksums instead of the timestamps to determine if files will be copied.
y
I/O timeout.
Timeout, in seconds, used for connections and read/write operations.

Note that the entire read/write operation does not need to complete within this timeout but some progress must be made, even if it is only a single byte.
120
Path where lock files are stored.
The lock path provides a location for to create lock files to prevent conflicting operations from being run concurrently.
/backup/db/lock
Use a neutral umask.
Sets the umask to 0000 so modes in the repository are created in a sensible way. The default directory mode is 0750 and default file mode is 0640. The lock and log directories set the directory and file mode to 0770 and 0660 respectively.

To use the executing user's umask instead specify neutral-umask=n in the config file or --no-neutral-umask on the command line.
n
Path where transient data is stored.
This path is used to store data for the asynchronous archive-push and archive-get command.

The asynchronous archive-push command writes acknowledgements into the spool path when it has successfully stored WAL in the archive (and errors on failure) so the foreground process can quickly notify . Acknowledgement files are very small (zero on success and a few hundred bytes on error).

The asynchronous archive-push process queues WAL in the spool path so it can be provided very quickly when requests it. Moving files to is most efficient when the spool path is on the same filesystem as pg_xlog/pg_wal.

The data stored in the spool path is not strictly temporary since it can and should survive a reboot. However, loss of the data in the spool path is not a problem. will simply recheck each WAL segment to ensure it is safely archived for archive-push and rebuild the queue for archive-get.

The spool path is intended to be located on a local Posix-compatible filesystem, not a remote filesystem such as NFS or CIFS.
/backup/db/spool
Max processes to use for compress/transfer.
Each process will perform compression and transfer to make the command run faster, but don't set process-max so high that it impacts database performance.
4
Protocol timeout.
Sets the timeout, in seconds, that the local or remote process will wait for a new message to be received on the protocol layer. This prevents processes from waiting indefinitely for a message. The protocol-timeout option must be greater than the db-timeout option.
630
Keep-alive enable.
Enables keep-alive messages on socket connections.
n
Keep-alive count.
Specifies the number of TCP keep-alive messages that can be lost before the connection is considered dead.

This option is available on systems that support the `TCP_KEEPCNT` socket option.
3
Keep-alive idle time.
Specifies the amount of time (in seconds) with no network activity after which the operating system should send a TCP keep-alive message.

This option is available on systems that support the `TCP_KEEPIDLE` socket option.
60
Keep-alive interval time.
Specifies the amount of time (in seconds) after which a TCP keep-alive message that has not been acknowledged should be retransmitted.

This option is available on systems that support the `TCP_KEEPINTVL` socket option.
30
The repository section defines options used to configure the repository.

Indexing: All repo- options are indexed to allow for configuring multiple repositories, though only a single repository is currently supported. For example, the repository is configured with the repo1-path, repo1-host, etc. options.

The repo-retention-* options define how long backups will be retained. Expiration only occurs when the number of complete backups exceeds the allowed retention. In other words, if retention-full is set to 2, then there must be 3 complete backups before the oldest will be expired. Make sure you always have enough space for retention + 1 backups.
Repository host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the host and the repository host.

When backing up and archiving to a locally mounted filesystem this setting is not required.
repo1.domain.com
exe path on the repository host.
Required only if the path to is different on the local and repository hosts. If not defined, the repository host exe path will be set the same as the local exe path.
same as local
/usr/lib/backrest/bin/pgbackrest
repository host configuration file.
Sets the location of the configuration file on the repository host. This is only required if the repository host configuration file is in a different location than the local configuration file.
/conf/pgbackrest/pgbackrest.conf
repository host configuration include path.
Sets the location of the configuration include path on the repository host. This is only required if the repository host configuration include path is in a different location than the local configuration include path.
/conf/pgbackrest/conf.d
repository host configuration path.
Sets the location of the configuration path on the repository host. This is only required if the repository host configuration path is in a different location than the local configuration path.
/conf/pgbackrest
Repository host user when repo-host is set.
Defines the user that will be used for operations on the repository host. Preferably this is not the postgres user but rather some other user like pgbackrest. If runs on the repository host the postgres user can be placed in the pgbackrest group so it has read permissions on the repository without being able to damage the contents accidentally.
repo-user
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol. Currently only SSH is supported
25
Hardlink files between backups in the repository.
Enable hard-linking of files in differential and incremental backups to their full backups. This gives the appearance that each backup is a full backup at the file-system level. Be careful, though, because modifying files that are hard-linked can affect all the backups in the set.
y
Path where backups and archive are stored.
The repository is where stores backups and archives WAL segments.

It may be difficult to estimate in advance how much space you'll need. The best thing to do is take some backups then record the size of different types of backups (full/incr/diff) and measure the amount of WAL generated per day. This will give you a general idea of how much space you'll need, though of course requirements will likely change over time as your database evolves.
/backup/db/backrest
Number of full backups to retain.
When a full backup expires, all differential and incremental backups associated with the full backup will also expire. When the option is not defined a warning will be issued. If indefinite retention is desired then set the option to the max value.
2
Number of differential backups to retain.
When a differential backup expires, all incremental backups associated with the differential backup will also expire. When not defined all differential backups will be kept until the full backups they depend on expire.
3
Backup type for WAL retention.
If set to full will keep archive logs for the number of full backups defined by repo-retention-archive. If set to diff (differential) will keep archive logs for the number of full and differential backups defined by repo-retention-archive, meaning if the last backup taken was a full backup, it will be counted as a differential for the purpose of repo-retention. If set to incr (incremental) will keep archive logs for the number of full, differential, and incremental backups defined by repo-retention-archive. It is recommended that this setting not be changed from the default which will only expire WAL in conjunction with expiring full backups.
diff
Number of backups worth of continuous WAL to retain.
WAL segments required to make a backup consistent are always retained until the backup is expired regardless of how this option is configured.
If this value is not set, then the archive to expire will default to the repo-retention-full (or repo-retention-diff) value corresponding to the repo-retention-archive-type if set to full (or diff). This will ensure that WAL is only expired for backups that are already expired.

This option must be set if repo-retention-archive-type is set to incr. If disk space is at a premium, then this setting, in conjunction with repo-retention-archive-type, can be used to aggressively expire WAL segments. However, doing so negates the ability to perform PITR from the backups with expired WAL and is therefore not recommended.
2
S3 repository access key.
AWS key used to access this bucket.
AKIAIOSFODNN7EXAMPLE
S3 repository secret access key.
AWS secret key used to access this bucket.
wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
S3 repository security token.
AWS security token used with temporary credentials.
AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22 ...
S3 repository bucket.
S3 bucket used to store the repository.

repositories can be stored in the bucket root by setting repo-path=/ but it is usually best to specify a prefix, such as /repo, so logs and other AWS generated content can also be stored in the bucket.
pg-backup
S3 SSL CA File.
Use a CA file other than the system default.
/etc/pki/tls/certs/ca-bundle.crt
S3 SSL CA Path.
Use a CA path other than the system default.
/etc/pki/tls/certs
S3 repository endpoint.
The AWS end point should be valid for the selected region.
s3.amazonaws.com
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
127.0.0.1
S3 repository port.
Port to use when connecting to the endpoint (or host if specified).
9000
S3 repository region.
The AWS region where the bucket was created.
us-east-1
S3 URI Style.
The following URI styles are supported:

- host
  - Connect to bucket.endpoint host.
- path
  - Connect to endpoint host and prepend bucket to URIs.

path
Verify S3 server certificate.
Disables verification of the S3 server certificate. This should only be used for testing or other scenarios where a certificate has been self-signed.
n
Type of storage used for the repository.
The following repository types are supported:

- cifs
  - Like posix, but disables links and directory fsyncs
- posix
  - Posix-compliant file systems
- s3
  - AWS Simple Storage Service

cifs
Cipher used to encrypt the repository.
The following repository types are supported:

- none
  - The repository is not encrypted
- aes-256-cbc
  - Advanced Encryption Standard with 256 bit key length

Note that encryption is always performed client-side even if the repository type (e.g. S3) supports encryption.
none
aes-256-cbc
Repository cipher passphrase.
Passphrase used to encrypt/decrypt files of the repository.
zWaf6XtpjIVZC5444yXB+cgFDFl7MxGlgkZSaoPvTGirhPygu4jOKOXf9LO4vjfO
The backup section defines settings related to backup.
Check that WAL segments are in the archive before backup completes.
Checks that all WAL segments required to make the backup consistent are present in the WAL archive. It's a good idea to leave this as the default unless you are using another method for archiving.

This option must be enabled if archive-copy is enabled.
n
Copy WAL segments needed for consistency to the backup.
This slightly paranoid option protects against corruption in the WAL segment archive by storing the WAL segments required for consistency directly in the backup. WAL segments are still stored in the archive so this option will use additional space.

On restore, the WAL segments will be present in pg_xlog/pg_wal and will use them in preference to calling the `restore_command`.

The archive-check option must be enabled if archive-copy is enabled.
y
Backup from the standby cluster.
Enable backup from standby to reduce load on the primary cluster. This option requires that both the primary and standby hosts be configured.
y
Validate data page checksums.
Directs to validate all data page checksums while backing up a cluster. This option is automatically enabled when data page checksums are enabled on the cluster.

Failures in checksum validation will not abort a backup. Rather, warnings will be emitted in the log (and to the console with default settings) and the list of invalid pages will be stored in the backup manifest.
n
Exclude paths/files from the backup.
All exclusions are relative to $PGDATA. If the exclusion ends with / then only files in the specified directory will be excluded, e.g. --exclude=junk/ will exclude all files in the $PGDATA/junk directory but include the directory itself. If the exclusion does not end with / then the file may match the exclusion exactly or match with / appended to the exclusion, e.g. --exclude=junk will exclude the $PGDATA/junk directory and all the files it contains.

Be careful using this feature -- it is very easy to exclude something critical that will make the backup inconsistent. Be sure to test your restores!

All excluded files will be logged at info level along with the exclusion rule. Be sure to audit the list of excluded files to ensure nothing unexpected is being excluded.Exclusions are not honored on delta restores. Any files/directories that were excluded by the backup will be removed on delta restore.This option should not be used to exclude logs from a backup. Logs can be moved out of the PGDATA directory using the log_directory setting, which has the benefit of allowing logs to be preserved after a restore.

Multiple exclusions may be specified on the command-line or in a configuration file.
junk/
Manifest save threshold during backup.
Defines how often the manifest will be saved during a backup. Saving the manifest is important because it stores the checksums and allows the resume function to work efficiently. The actual threshold used is 1% of the backup size or manifest-save-threshold, whichever is greater.

Size can be entered in bytes (default) or KB, MB, GB, TB, or PB where the multiplier is a power of 1024.
5G
Allow resume of failed backup.
Defines whether the resume feature is enabled. Resume can greatly reduce the amount of time required to run a backup after a previous backup of the same type has failed. It adds complexity, however, so it may be desirable to disable in environments that do not require the feature.
n
Force a checkpoint to start backup quickly.
Forces a checkpoint (by passing y to the fast parameter of `pg_start_backup()`) so the backup begins immediately. Otherwise the backup will start after the next regular checkpoint.

This feature only works in >= 8.4.
y
Stop prior failed backup on new backup.
This will only be done if an exclusive advisory lock can be acquired to demonstrate that the prior failed backup process has really stopped.

This feature relies on pg_is_in_backup() so only works on >= 9.3.

This feature is not supported for >= 9.6 since backups are run in non-exclusive mode.

The setting is disabled by default because it assumes that is the only process doing exclusive online backups. It depends on an advisory lock that only sets so it may abort other processes that do exclusive online backups. Note that base_backup and pg_dump are safe to use with this setting because they do not call `pg_start_backup()` so are not exclusive.
y
The archive section defines options for the archive-push and archive-get commands.
Push/get WAL segments asynchronously.
Enables asynchronous operation for the archive-push and archive-get commands.

Asynchronous operation is more efficient because it can reuse connections and take advantage of parallelism. See the spool-path, archive-get-queue-max, and archive-push-queue-max options for more information.
y
Maximum size of the archive-get queue.
Specifies the maximum size of the archive-get queue when archive-async is enabled. The queue is stored in the spool-path and is used to speed providing WAL to .

Size can be entered in bytes (default) or KB, MB, GB, TB, or PB where the multiplier is a power of 1024.
1073741824
Maximum size of the archive queue.
After the limit is reached, the following will happen:

1. will notify that the WAL was successfully archived, then DROP IT.
2. A warning will be output to the Postgres log.

If this occurs then the archive log stream will be interrupted and PITR will not be possible past that point. A new backup will be required to regain full restore capability.

In asynchronous mode the entire queue will be dropped to prevent spurts of WAL getting through before the queue limit is exceeded again.

The purpose of this feature is to prevent the log volume from filling up at which point Postgres will stop completely. Better to lose the backup than have go down.

Size can be entered in bytes (default) or KB, MB, GB, TB, or PB where the multiplier is a power of 1024.
1GB
Archive timeout.
Set maximum time, in seconds, to wait for each WAL segment to reach the archive repository. The timeout applies to the check and backup commands when waiting for WAL segments required for backup consistency to be archived.
30
The restore section defines settings used for restoring backups.
Restore only specified databases.
This feature allows only selected databases to be restored. Databases not specifically included will be restored as sparse, zeroed files to save space but still allow to perform recovery. After recovery the databases that were not included will not be accessible but can be removed with the drop database command. built-in databases (template0, template1, and postgres) are always restored.The {[dash]}-db-include option can be passed multiple times to specify more than one database to include.
db_main
Restore all symlinks.
By default symlinked directories and files are restored as normal directories and files in $PGDATA. This is because it may not be safe to restore symlinks to their original destinations on a system other than where the original backup was performed. This option restores all the symlinks just as they were on the original system where the backup was performed.
y
Modify the destination of a symlink.
Allows the destination file or path of a symlink to be changed on restore. This is useful for restoring to systems that have a different storage layout than the original system where the backup was generated.
pg_xlog=/data/xlog
Set an option in recovery.conf.
See http://www.postgresql.org/docs/X.X/static/recovery-config.html for details on recovery.conf options (replace X.X with your version). This option can be used multiple times.The restore_command option will be automatically generated but can be overridden with this option. Be careful about specifying your own restore_command as is designed to handle this for you. Target Recovery options (recovery_target_name, recovery_target_time, etc.) are generated automatically by and should not be set with this option.Since does not start after writing the recovery.conf file, it is always possible to edit/check recovery.conf before manually restarting.
primary_conninfo=db.mydomain.com
Restore a tablespace into the specified directory.
Moves a tablespace to a new location during the restore. This is useful when tablespace locations are not the same on a replica, or an upgraded system has different mount points.

Since 9.2 tablespace locations are not stored in pg_tablespace so moving tablespaces can be done with impunity. However, moving a tablespace to the data_directory is not recommended and may cause problems. For more information on moving tablespaces http://www.databasesoup.com/2013/11/moving-tablespaces.html is a good resource.
ts_01=/db/ts_01
Restore all tablespaces into the specified directory.
By default tablespaces are restored into their original locations and while this behavior can be modified by with the tablespace-map open it is sometime preferable to remap all tablespaces to a new directory all at once. This is particularly useful for development or staging systems that may not have the same storage layout as the original system where the backup was generated.

The path specified will be the parent path used to create all the tablespaces in the backup.
/data/tablespace
A stanza defines the backup configuration for a specific database cluster. The stanza section must define the database cluster path and host/user if the database cluster is remote. Also, any global configuration sections can be overridden to define stanza-specific settings.

Indexing: All pg- options are indexed to allow for configuring multiple hosts. For example, a single primary is configured with the pg1-path, pg1-port, etc. options. If a standby is configured then index the pg- options on the repository host as pg2- (e.g. pg2-host, pg2-path, etc).
exe path on the host.
Required only if the path to is different on the local and hosts. If not defined, the database host exe path will be set the same as the local exe path.
same as local
/usr/lib/backrest/bin/pgbackrest
database host configuration file.
Sets the location of the configuration file on the host. This is only required if the host configuration file is in a different location than the local configuration file.
/conf/pgbackrest/pgbackrest.conf
database host configuration include path.
Sets the location of the configuration include path on the host. This is only required if the host configuration include path is in a different location than the local configuration include path.
/conf/pgbackrest/conf.d
database host configuration path.
Sets the location of the configuration path on the host. This is only required if the host configuration path is in a different location than the local configuration path.
/conf/pgbackrest
host for operating remotely via SSH.
Used for backups where the host is different from the repository host.
db.domain.com
host logon user when pg-host is set.
This user will also own the remote process and will initiate connections to . For this to work correctly the user should be the database cluster owner which is generally postgres, the default.
db_owner
data directory.
This should be the same as the data_directory setting in postgresql.conf. Even though this value can be read from postgresql.conf or it is prudent to set it in case those resources are not available during a restore or offline backup scenario.

The pg-path option is tested against the value reported by on every online backup so it should always be current.
/data/db
port.
Port that is running on. This usually does not need to be specified as most clusters run on the default port.
6543
unix socket path.
The unix socket directory that was specified when was started. will automatically look in the standard location for your OS so there is usually no need to specify this setting unless the socket directory was explicitly modified with the unix_socket_directory setting in postgresql.conf.
/var/run/postgresql
database user.
The database user name used when connecting to . If not specified will connect with the local OS user or PGUSER.
backupuser
host port when pg-host is set.
Use this option to specify a non-default port for the host protocol. Currently only SSH is supported
25

{[project]} Command Reference

The {[project]} Command Reference details all commands and options.
Commands are used to execute the various functions. Here the command options are listed exhaustively, that is, each option applicable to a command is listed with that command even if it applies to one or more other commands. This includes all the options that may also configured in pgbackrest.conf.

Non-boolean options configured in pgbackrest.conf can be reset to default on the command-line by using the reset- prefix. This feature may be used to restore a backup directly on a repository host. Normally, will error because it can see that the database host is remote and restores cannot be done remotely. By adding --reset-pg1-host on the command-line, will ignore the remote database host and restore locally. It may be necessary to pass a new --pg-path to force the restore to happen in a specific path, i.e. not the path used on the database host.

The no- prefix may be used to set a boolean option to false on the command-line.

Any option may be set in an environment variable using the PGBACKREST_ prefix and the option name in all caps replacing - with _, e.g. pg1-path becomes PGBACKREST_PG1_PATH and stanza becomes PGBACKREST_STANZA. Boolean options are represented as they would be in a configuration file, e.g. PGBACKREST_COMPRESS="n", and reset-* variants are not allowed. Options that that can be specified multiple times on the command-line or in a config file can be represented by separating the values with colons, e.g. PGBACKREST_DB_INCLUDE="db1:db2".

Command-line options override environment options which override config file options.

General Options

Cipher passphrase for current command.
Specify an ad hoc cipher passphrase for the current command.

FOR INTERNAL USE ONLY. DO NOT USE ON A PRODUCTION REPOSITORY.
zWaf6XtpjIVZC5444yXB+cgFDFl7MxGlgkZSaoPvTGirhPygu4jOKOXf9LO4vjfO
configuration file.
Use this option to specify a different configuration file than the default.
/conf/pgbackrest/pgbackrest.conf
Path to additional configuration files.
Configuration files existing in the specified location with extension .conf will be concatenated with the configuration file, resulting in one configuration file.
/conf/pgbackrest/conf.d
Base path of configuration files.
This setting is used to override the default base path setting for the --config and --config-include-path options unless they are explicitly set on the command-line.

For example, passing only `--config-path=/conf/pgbackrest` results in the --config default being set to `/conf/pgbackrest/pgbackrest.conf` and the --config-include-path default being set to `/conf/pgbackrest/conf.d`.
/conf/pgbackrest
Execute a dry-run for the command.
The {[dash]}-dry-run option is a command-line only option and can be passed when it is desirable to determine what modifications will be made by the command without the command actually making any modifications.
y
Do not transform data.
Do not transform (i.e, encrypt, decompress, etc.) data for the current command.
y
Defines the stanza.
A stanza is the configuration for a database cluster that defines where it is located, how it will be backed up, archiving options, etc. Most db servers will only have one Postgres database cluster and therefore one stanza, whereas backup servers will have a stanza for every database cluster that needs to be backed up.

It is tempting to name the stanza after the primary cluster but a better name describes the databases contained in the cluster. Because the stanza name will be used for the primary and all replicas it is more appropriate to choose a name that describes the actual function of the cluster, such as app or dw, rather than the local cluster name, such as main or prod.
main

Commands

Backup a database cluster.
does not have a built-in scheduler so it's best to run it from cron or some other scheduling mechanism.
Backup type.
The following backup types are supported:

- full
  - all database cluster files will be copied and there will be no dependencies on previous backups.
- incr
  - incremental from the last successful backup.
- diff
  - like an incremental backup but always based on the last full backup.

full
Force an offline backup.
When used with --no-start-stop a backup will be run even if thinks that is running. This option should be used with extreme care as it will likely result in a bad backup.

There are some scenarios where a backup might still be desirable under these conditions. For example, if a server crashes and the database cluster volume can only be mounted read-only, it would be a good idea to take a backup even if postmaster.pid is present. In this case it would be better to revert to the prior backup and replay WAL, but possibly there is a very important transaction in a WAL segment that did not get archived.
y
Perform an online backup.
Specifying --no-online prevents from running `pg_start_backup()` and `pg_stop_backup()` on the database cluster. In order for this to work should be shut down and will generate an error if it is not.

The purpose of this option is to allow offline backups. The pg_xlog/pg_wal directory is copied as-is and archive-check is automatically disabled for the backup.
n

Full Backup

{[backrest-exe]} --stanza=db --type=full backup
Run a full backup on the db stanza. --type can also be set to incr or diff for incremental or differential backups. However, if no full backup exists then a full backup will be forced even if incr or diff is requested.
Push a WAL segment to the archive.
The WAL segment may be pushed immediately to the archive or stored locally depending on the value of archive-async
{[backrest-exe]} --stanza=db archive-push %p
Accepts a WAL segment from and archives it in the repository defined by repo-path. %p is how specifies the location of the WAL segment to be archived.
Get a WAL segment from the archive.
WAL segments are required for restoring a cluster or maintaining a replica.
{[backrest-exe]} --stanza=db archive-get %f %p
Retrieves a WAL segment from the repository. This command is used in recovery.conf to restore a backup, perform PITR, or as an alternative to streaming for keeping a replica up to date. %f is how specifies the WAL segment it needs and %p is the location where it should be copied.
Check the configuration.
The check command validates that and the archive_command setting are configured correctly for archiving and backups. It detects misconfigurations, particularly in archiving, that result in incomplete backups because required WAL segments did not reach the archive. The command can be run on the database or the repository host. The command may also be run on the standby host, however, since `pg_switch_xlog()`/`pg_switch_wal()` cannot be performed on the standby, the command will only test the repository configuration.

Note that `pg_create_restore_point('pgBackRest Archive Check')` and `pg_switch_xlog()`/`pg_switch_wal()` are called to force to archive a WAL segment. Restore points are only supported in >= 9.1 so for older versions the check command may fail if there has been no write activity since the last log rotation, therefore it is recommended that activity be generated by the user if there have been no writes since the last WAL switch before running the check command.
{[backrest-exe]} --stanza=db check
Expire backups that exceed retention.
does backup rotation but is not concerned with when the backups were created. If two full backups are configured for retention, will keep two full backups no matter whether they occur two hours or two weeks apart.
{[backrest-exe]} --stanza=db expire
Expire (rotate) any backups that exceed the defined retention. Expiration is run automatically after every successful backup, so there is no need to run this command separately unless you have reduced retention, usually to free up some space.
Create the repository.
Creates the bucket if repo-type=s3.

FOR INTERNAL USE ONLY. DO NOT USE ON A PRODUCTION REPOSITORY.

Create repository

{[backrest-exe]} repo-create

Create the repository.
Get a file from the repository.
Similar to the unix cat command but options are different.
Ignore missing source file.
Exit with 1 if the source file is missing but don't throw an error.
y

Get a file from the repository

{[backrest-exe]} repo-get backup/demo/file.txt

Get a file from the demo stanza.
List paths/files in the repository.
Similar to the unix ls command but options and output are different. Only information provided by repository storage drivers is available: name, type, size, (modify) time, and destination (for drivers that support links).
Filter output with a regular expression.
The filter is applied against the file/path names before they are output.
(F|D|I)$
Output format.
The following output types are supported:

- text
  - Simple list with one file/link/path name on each line.
- json
  - Detailed file/link/path information in JSON format.

json
Include all subpaths in output.
All subpaths and their files will be included in the output.
y
Sort output ascending, descending, or none.
The following sort types are supported:

- asc
  - sort ascending.
- desc
  - sort descending.
- none
  - no sorting.

desc

List all backups in a stanza

{[backrest-exe]} repo-ls backup/demo

List all backups in the demo stanza.
Put a file in the repository.
Similar to the unix tee command but options and behavior are different.

FOR INTERNAL USE ONLY. DO NOT USE ON A PRODUCTION REPOSITORY.

Put a file in the repository

cat file.txt {[backrest-exe]} repo-put backup/demo/file.txt

Put a file in the demo stanza.
Remove paths/files in the repository.
Similar to the unix rm command but options are different.

FOR INTERNAL USE ONLY. DO NOT USE ON A PRODUCTION REPOSITORY.
Remove all sub file/paths.
All subpaths and their files will be removed.
y

Remove backup

{[backrest-exe]} rm --recurse backup/demo/20190718-155825F

Remove 20190718-155825F backup in the demo stanza.
Restore a database cluster.
This command is generally run manually, but there are instances where it might be automated.
Backup set to restore.
The backup set to be restored. latest will restore the latest backup, otherwise provide the name of the backup to restore.
20150131-153358F_20150131-153401I
Force a restore.
By itself this option forces the data and tablespace paths to be completely overwritten. In combination with --delta a timestamp/size delta will be performed instead of using checksums.
y
Recovery type.
The following recovery types are supported:

- default
  - recover to the end of the archive stream.
- immediate
  - recover only until the database becomes consistent. This option is only supported on >= 9.4.
- name
  - recover the restore point specified in --target.
- xid
  - recover to the transaction id specified in --target.
- time
  - recover to the time specified in --target.
- preserve
  - preserve the existing recovery.conf file.
- standby
  - add standby_mode=on to recovery.conf file so cluster will start in standby mode.
- none
  - no recovery.conf file is written so will attempt to achieve consistency using WAL segments present in pg_xlog/pg_wal. Provide the required WAL segments or use the archive-copy setting to include them with the backup.

xid
Recovery target.
Defines the recovery target when --type is name, xid, or time.
2015-01-30 14:15:11 EST
Stop just before the recovery target is reached.
Defines whether recovery to the target would be exclusive (the default is inclusive) and is only valid when --type is time or xid. For example, using --target-exclusive would exclude the contents of transaction 1007 when --type=xid and --target=1007. See the recovery_target_inclusive option in the docs for more information.
n
Action to take when recovery target is reached.
This option is effective when hot_standby=on is configured in postgresql.conf, otherwise the cluster will be promoted when the target is reached or there is no more WAL in the archive.

The following actions are supported:

- pause
  - pause when recovery target is reached. ( >= 9.1)
- promote
  - promote and switch timeline when recovery target is reached. ( >= 9.1)
- shutdown
  - shutdown server when recovery target is reached. ( >= 9.5)

promote
Recover along a timeline.
See recovery_target_timeline in the docs for more information.
3

Restore Latest

{[backrest-exe]} --stanza=db --type=name --target=release restore
Restores the latest database cluster backup and then recovers to the release restore point.
Retrieve information about backups.
The info command operates on a single stanza or all stanzas. Text output is the default and gives a human-readable summary of backups for the stanza(s) requested. This format is subject to change with any release.

For machine-readable output use --output=json. The JSON output contains far more information than the text output and is kept stable unless a bug is found.
Output format.
The following output types are supported:

- text
  - Human-readable summary of backup information.
- json
  - Exhaustive machine-readable backup information in JSON format.

json
Backup set to detail.
Details include a list of databases (with OIDs) in the backup set (excluding template databases), tablespaces (with OIDs) with the destination where they will be restored by default, and symlinks with the destination where they will be restored when --link-all is specified.
20150131-153358F_20150131-153401I

Information for a single stanza

{[backrest-exe]} --stanza=db --output=json info

Get information about backups in the db stanza.

Information for all stanzas

{[backrest-exe]} --output=json info

Get information about backups for all stanzas in the repository.
Get help.
Three levels of help are provided. If no command is specified then general help will be displayed. If a command is specified then a full description of the command will be displayed along with a list of valid options. If an option is specified in addition to a command then the a full description of the option as it applies to the command will be displayed.

Help for the backup command

{[backrest-exe]} help backup

Get help for the backup command.

Help for backup command, --force option

{[backrest-exe]} help backup force

Get help for the force option of the backup command.
Allow processes to run.
If the processes were previously stopped using the stop command then they can be started again using the start command. Note that this will not immediately start up any processes but they are allowed to run.

Start processes for stanza main

{[backrest-exe]} --stanza=main start

Allows processes to run for the main stanza.
Stop processes from running.
Does not allow any new processes to run. By default running processes will be allowed to complete successfully. Use the --force option to terminate running processes.

processes will return an error if they are run after the stop command completes.
Force all processes to stop.
This option will send TERM signals to all running processes to effect a graceful but immediate shutdown. Note that this will also shutdown processes that were initiated on another system but have remotes running on the current system. For instance, if a backup was started on the backup server then running stop --force on the database server will shutdown the backup process on the backup server.
y

Stop processes for all stanzas

{[backrest-exe]} stop

Stop new processes for all stanzas but allow any current process to complete.
Get version.
Displays installed version.

Get version

{[backrest-exe]} version

Get version.
Create the required stanza data.
The stanza-create command must be run on the host where the repository is located after the stanza has been configured in pgbackrest.conf.
Force stanza creation.
This option is no longer supported.
n
Create on an online cluster.
Specifying --no-online prevents from connecting to when creating the stanza.
n

Create required stanza data

{[backrest-exe]} --stanza=db stanza-create

Create the required data for the db stanza.
Upgrade a stanza.
Immediately after upgrading to a newer major version, the pg-path for all configurations must be set to the new database location and the stanza-upgrade run on the repository host. If the database is offline use the --no-online option.
Update an online cluster.
Specifying --no-online prevents from connecting to when upgrading the stanza.
n

Upgrade a stanza

{[backrest-exe]} --stanza=db stanza-upgrade

Upgrade the db stanza to a new version of .
Delete a stanza.
The stanza-delete command removes data in the repository associated with a stanza.Use this command with caution &mdash; it will permanently remove all backups and archives from the repository for the specified stanza. To delete a stanza:

- Shut down the cluster associated with the stanza (or use --force to override).
- Run the stop command on the repository host.
- Run the stanza-delete command on the repository host.

Once the command successfully completes, it is the responsibility of the user to remove the stanza from all configuration files.
Force stanza delete.
If is still running for the stanza, then this option can be used to force the stanza to be deleted from the repository.
n

Delete a stanza

{[backrest-exe]} --stanza=db stanza-delete

Delete the db stanza repository.