Table of Contents
3
4
5
9
10
11
1
Introduction
Commands are used to execute the various pgBackRest 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.
2
Archive Get Command (archive-get)
WAL segments are required for restoring a PostgreSQL cluster or maintaining a replica.
2.1
Command Options
2.1.1
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
2.1.2
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
2.1.3
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
2.1.4
Backup User Option (--backup-user)
Backup host user when backup-host is set.
Defines the user that will be used for operations on the backup server. Preferably this is not the postgres user but rather some other user like backrest. If PostgreSQL runs on the backup server the postgres user can be placed in the backrest group so it has read permissions on the repository without being able to damage the contents accidentally.
default: backrest
example: --backup-user=backrest
2.2
General Options
2.2.1
Buffer Size Option (--buffer-size)
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.
default: 4194304
example: --buffer-size=32768
2.2.2
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
2.2.3
Compress Option (--compress)
Use gzip file compression.
Backup files are compatible with command-line gzip tools.
default: y
example: --no-compress
2.2.4
Compress Level Option (--compress-level)
Compression level for stored files.
Sets the zlib level to be used for file compression when compress=y.
default: 6
allowed: 0-9
example: --compress-level=9
2.2.5
Network Compress Level Option (--compress-level-network)
Compression level for network transfer when compress=n.
Sets the zlib level to be used for protocol compression when compress=n and the database cluster is not on the same host as the backup. Protocol compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress=y 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.
default: 3
allowed: 0-9
example: --compress-level-network=1
2.2.6
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
2.2.7
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
2.2.8
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
2.2.9
Neutral Umask Option (--neutral-umask)
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.
default: y
example: --no-neutral-umask
2.2.10
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Sets the timeout, in seconds, that the master 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.
default: 1830
allowed: 0.1-604800
example: --protocol-timeout=630
2.2.11
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
2.2.12
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
2.2.13
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
2.2.14
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
2.2.15
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
2.2.16
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
2.2.17
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
2.2.18
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
2.2.19
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
2.2.20
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
2.3
Log Options
2.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
2.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
2.3.3
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Specifies which log levels must will be 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
default: warn
example: --log-level-stderr=error
2.3.4
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
2.4
Stanza Options
2.4.1
Database Path Option (--db-path)
Cluster 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 the database cluster it is prudent to set it in case those resources are not available during a restore or offline backup scenario.

The db-path option is tested against the value reported by PostgreSQL on every online backup so it should always be current.
example: --db-path=/data/db
3
Archive Push Command (archive-push)
The WAL segment may be pushed immediately to the archive or stored locally depending on the value of archive-async
3.1
Command Options
3.1.1
Asynchronous Archiving Option (--archive-async)
Archive WAL segments asynchronously.
WAL segments will be copied to the local repo, then a process will be forked to compress the segment and transfer it to the remote repo if configured. Control will be returned to PostgreSQL as soon as the WAL segment is copied locally.
default: n
example: --archive-async
3.1.2
Maximum Archive Queue Size Option (--archive-queue-max)
Limit size (in bytes) of the PostgreSQL archive queue.
After the limit is reached, the following will happen:
  1. pgBackRest will notify PostgreSQL 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 PostgreSQL go down.
example: --archive-queue-max=1073741824
3.1.3
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
3.1.4
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
3.1.5
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
3.1.6
Backup User Option (--backup-user)
Backup host user when backup-host is set.
Defines the user that will be used for operations on the backup server. Preferably this is not the postgres user but rather some other user like backrest. If PostgreSQL runs on the backup server the postgres user can be placed in the backrest group so it has read permissions on the repository without being able to damage the contents accidentally.
default: backrest
example: --backup-user=backrest
3.2
General Options
3.2.1
Archive Timeout Option (--archive-timeout)
Archive timeout.
Set maximum time, in seconds, to wait for WAL segments to reach the archive. The timeout applies to the check command and to the backup command when waiting for WAL segments required to make the backup consistent to be archived.
default: 60
allowed: 0.1-86400
example: --archive-timeout=30
3.2.2
Buffer Size Option (--buffer-size)
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.
default: 4194304
example: --buffer-size=32768
3.2.3
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
3.2.4
Compress Option (--compress)
Use gzip file compression.
Backup files are compatible with command-line gzip tools.
default: y
example: --no-compress
3.2.5
Compress Level Option (--compress-level)
Compression level for stored files.
Sets the zlib level to be used for file compression when compress=y.
default: 6
allowed: 0-9
example: --compress-level=9
3.2.6
Network Compress Level Option (--compress-level-network)
Compression level for network transfer when compress=n.
Sets the zlib level to be used for protocol compression when compress=n and the database cluster is not on the same host as the backup. Protocol compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress=y 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.
default: 3
allowed: 0-9
example: --compress-level-network=1
3.2.7
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
3.2.8
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
3.2.9
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
3.2.10
Neutral Umask Option (--neutral-umask)
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.
default: y
example: --no-neutral-umask
3.2.11
Process Maximum Option (--process-max)
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.
default: 1
allowed: 1-96
example: --process-max=4
3.2.12
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Sets the timeout, in seconds, that the master 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.
default: 1830
allowed: 0.1-604800
example: --protocol-timeout=630
3.2.13
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
3.2.14
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
3.2.15
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
3.2.16
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
3.2.17
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
3.2.18
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
3.2.19
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
3.2.20
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
3.2.21
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
3.2.22
Spool Path Option (--spool-path)
Path where WAL segments are spooled during async archiving.
When asynchronous archiving is enabled pgBackRest needs a local directory to store WAL segments before they are compressed and moved to the repository. Depending on the volume of WAL generated this directory could become very large so be sure to plan accordingly.

The archive-queue-max option can be used to limit the amount of WAL that will be spooled locally.
default: /var/spool/pgbackrest
example: --spool-path=/backup/db/spool
3.2.23
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
3.3
Log Options
3.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
3.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
3.3.3
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Specifies which log levels must will be 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
default: warn
example: --log-level-stderr=error
3.3.4
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
3.4
Stanza Options
3.4.1
Database Host Option (--db-host)
Cluster host for operating remotely via SSH.
Used for backups where the database cluster host is different from the backup host.
example: --db-host=db.domain.com
3.4.2
Database Path Option (--db-path)
Cluster 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 the database cluster it is prudent to set it in case those resources are not available during a restore or offline backup scenario.

The db-path option is tested against the value reported by PostgreSQL on every online backup so it should always be current.
example: --db-path=/data/db
4
Backup Command (backup)
pgBackRest does not have a built-in scheduler so it's best to run it from cron or some other scheduling mechanism.
4.1
Command Options
4.1.1
Check Archive Option (--archive-check)
Check that WAL segments are present 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.
default: y
example: --no-archive-check
4.1.2
Copy Archive Option (--archive-copy)
Copy WAL segments needed for consistency to the backup.
This slightly paranoid option protects against corruption or premature expiration in the WAL segment archive by storing the WAL segments directly in the backup. PITR won't be possible without the WAL segment archive and this option also consumes more space.

Even though WAL segments will be restored with the backup, PostgreSQL will ignore them if a recovery.conf file exists and instead use archive_command to fetch WAL segments. Specifying type=none when restoring will not create recovery.conf and force PostgreSQL to use the WAL segments in pg_xlog. This will get the database cluster to a consistent state.
default: n
example: --archive-copy
4.1.3
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
4.1.4
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
4.1.5
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
4.1.6
Backup from Standby Option (--backup-standby)
Backup from the standby cluster.
Enable backup from standby to reduce load on the master cluster. This option requires that both the master and standby hosts be configured.
default: n
example: --backup-standby
4.1.7
Force Option (--force)
Force an offline backup.
When used with --no-start-stop a backup will be run even if pgBackRest thinks that PostgreSQL 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.
default: n
example: --force
4.1.8
Hardlink Option (--hardlink)
Hardlink files between backups.
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. Be careful, though, because modifying files that are hard-linked can affect all the backups in the set.
default: n
example: --hardlink
4.1.9
Manifest Save Threshold Option (--manifest-save-threshold)
Manifest save threshold during backup.
Defines how often the manifest will be saved during a backup (in bytes). 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.
default: 1073741824
example: --manifest-save-threshold=5368709120
4.1.10
Resume Option (--resume)
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.
default: y
example: --no-resume
4.1.11
Start Fast Option (--start-fast)
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 PostgreSQL >= 8.4.
default: n
example: --start-fast
4.1.12
Stop Auto Option (--stop-auto)
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 PostgreSQL >= 9.3.

The setting is disabled by default because it assumes that pgBackRest is the only process doing exclusive online backups. It depends on an advisory lock that only pgBackRest 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.
default: n
example: --stop-auto
4.1.13
Type Option (--type)
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.
default: incr
example: --type=full
4.2
Expire Options
4.2.1
Archive Retention Option (--retention-archive)
Number of backups worth of continuous WAL to retain.
Note that the 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 retention-full (or retention-diff) value corresponding to the 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 retention-archive-type is set to incr. If disk space is at a premium, then this setting, in conjunction with 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.
allowed: 1-999999999
example: --retention-archive=2
4.2.2
Archive Retention Type Option (--retention-archive-type)
Backup type for WAL retention.
If set to full pgBackRest will keep archive logs for the number of full backups defined by retention-archive. If set to diff (differential) pgBackRest will keep archive logs for the number of full and differential backups defined by retention-archive, meaning if the last backup taken was a full backup, it will be counted as a differential for the purpose of retention. If set to incr (incremental) pgBackRest will keep archive logs for the number of full, differential, and incremental backups defined by 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.
default: full
example: --retention-archive-type=diff
4.2.3
Differential Retention Option (--retention-diff)
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.
allowed: 1-999999999
example: --retention-diff=3
4.2.4
Full Retention Option (--retention-full)
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.
allowed: 1-999999999
example: --retention-full=2
4.3
General Options
4.3.1
Archive Timeout Option (--archive-timeout)
Archive timeout.
Set maximum time, in seconds, to wait for WAL segments to reach the archive. The timeout applies to the check command and to the backup command when waiting for WAL segments required to make the backup consistent to be archived.
default: 60
allowed: 0.1-86400
example: --archive-timeout=30
4.3.2
Buffer Size Option (--buffer-size)
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.
default: 4194304
example: --buffer-size=32768
4.3.3
Page Checksums Option (--checksum-page)
Validate data page checksums.
Directs pgBackRest to validate all data page checksums while backing up a cluster. This option will be automatically enabled when the required C library is present and 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.
example: --no-checksum-page
4.3.4
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
4.3.5
Compress Option (--compress)
Use gzip file compression.
Backup files are compatible with command-line gzip tools.
default: y
example: --no-compress
4.3.6
Compress Level Option (--compress-level)
Compression level for stored files.
Sets the zlib level to be used for file compression when compress=y.
default: 6
allowed: 0-9
example: --compress-level=9
4.3.7
Network Compress Level Option (--compress-level-network)
Compression level for network transfer when compress=n.
Sets the zlib level to be used for protocol compression when compress=n and the database cluster is not on the same host as the backup. Protocol compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress=y 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.
default: 3
allowed: 0-9
example: --compress-level-network=1
4.3.8
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
4.3.9
Database Timeout Option (--db-timeout)
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).
default: 1800
allowed: 0.1-604800
example: --db-timeout=600
4.3.10
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
4.3.11
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
4.3.12
Neutral Umask Option (--neutral-umask)
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.
default: y
example: --no-neutral-umask
4.3.13
Online Option (--online)
Perform an online backup.
Specifying --no-online prevents pgBackRest from running pg_start_backup() and pg_stop_backup() on the database cluster. In order for this to work PostgreSQL should be shut down and pgBackRest will generate an error if it is not.

The purpose of this option is to allow offline backups. The pg_xlog directory is copied as-is and archive-check is automatically disabled for the backup.
default: y
example: --no-online
4.3.14
Process Maximum Option (--process-max)
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.
default: 1
allowed: 1-96
example: --process-max=4
4.3.15
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Sets the timeout, in seconds, that the master 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.
default: 1830
allowed: 0.1-604800
example: --protocol-timeout=630
4.3.16
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
4.3.17
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
4.3.18
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
4.3.19
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
4.3.20
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
4.3.21
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
4.3.22
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
4.3.23
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
4.3.24
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
4.3.25
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
4.4
Log Options
4.4.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
4.4.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
4.4.3
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Specifies which log levels must will be 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
default: warn
example: --log-level-stderr=error
4.4.4
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
4.5
Stanza Options
4.5.1
Database Host Command Option (--db-cmd)
pgBackRest exe path on the database host.
Required only if the path to pgbackrest is different on the local and database hosts. If not defined, the database host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --db-cmd=/usr/lib/backrest/bin/pgbackrest
4.5.2
Database Host Configuration Option (--db-config)
pgBackRest database host configuration file.
Sets the location of the configuration file on the database host. This is only required if the database host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --db-config=/etc/pgbackrest_db.conf
4.5.3
Database Host Option (--db-host)
Cluster host for operating remotely via SSH.
Used for backups where the database cluster host is different from the backup host.
example: --db-host=db.domain.com
4.5.4
Database Path Option (--db-path)
Cluster 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 the database cluster it is prudent to set it in case those resources are not available during a restore or offline backup scenario.

The db-path option is tested against the value reported by PostgreSQL on every online backup so it should always be current.
example: --db-path=/data/db
4.5.5
Database Port Option (--db-port)
Cluster port.
Port that PostgreSQL is running on. This usually does not need to be specified as most database clusters run on the default port.
default: 5432
example: --db-port=6543
4.5.6
Database Socket Path Option (--db-socket-path)
Cluster unix socket path.
The unix socket directory that was specified when PostgreSQL was started. pgBackRest will automatically look in the standard location for your OS so there usually no need to specify this setting unless the socket directory was explicitly modified with the unix_socket_directory setting in postgressql.conf.
example: --db-socket-path=/var/run/postgresql
4.5.7
Database User Option (--db-user)
Cluster host logon user when db-host is set.
This user will also own the remote pgBackRest process and will initiate connections to PostgreSQL. For this to work correctly the user should be the PostgreSQL database cluster owner which is generally postgres, the default.
default: postgres
example: --db-user=db_owner
5
Check Command (check)
The check command validates that pgBackRest 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 backup host. The command may also be run on the standby host, however, since pg_switch_xlog() 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() are called to force PostgreSQL to archive a WAL segment. Restore points are only supported in PostgreSQL >= 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 xlog switch before running the check command.
5.1
Command Options
5.1.1
Check Archive Option (--archive-check)
Check that WAL segments are present 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.
default: y
example: --no-archive-check
5.1.2
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
5.1.3
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
5.1.4
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
5.1.5
Backup from Standby Option (--backup-standby)
Backup from the standby cluster.
Enable backup from standby to reduce load on the master cluster. This option requires that both the master and standby hosts be configured.
default: n
example: --backup-standby
5.1.6
Backup User Option (--backup-user)
Backup host user when backup-host is set.
Defines the user that will be used for operations on the backup server. Preferably this is not the postgres user but rather some other user like backrest. If PostgreSQL runs on the backup server the postgres user can be placed in the backrest group so it has read permissions on the repository without being able to damage the contents accidentally.
default: backrest
example: --backup-user=backrest
5.2
General Options
5.2.1
Archive Timeout Option (--archive-timeout)
Archive timeout.
Set maximum time, in seconds, to wait for WAL segments to reach the archive. The timeout applies to the check command and to the backup command when waiting for WAL segments required to make the backup consistent to be archived.
default: 60
allowed: 0.1-86400
example: --archive-timeout=30
5.2.2
Buffer Size Option (--buffer-size)
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.
default: 4194304
example: --buffer-size=32768
5.2.3
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
5.2.4
Compress Level Option (--compress-level)
Compression level for stored files.
Sets the zlib level to be used for file compression when compress=y.
default: 6
allowed: 0-9
example: --compress-level=9
5.2.5
Network Compress Level Option (--compress-level-network)
Compression level for network transfer when compress=n.
Sets the zlib level to be used for protocol compression when compress=n and the database cluster is not on the same host as the backup. Protocol compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress=y 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.
default: 3
allowed: 0-9
example: --compress-level-network=1
5.2.6
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
5.2.7
Database Timeout Option (--db-timeout)
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).
default: 1800
allowed: 0.1-604800
example: --db-timeout=600
5.2.8
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
5.2.9
Neutral Umask Option (--neutral-umask)
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.
default: y
example: --no-neutral-umask
5.2.10
Online Option (--online)
Perform an online backup.
Specifying --no-online prevents pgBackRest from running pg_start_backup() and pg_stop_backup() on the database cluster. In order for this to work PostgreSQL should be shut down and pgBackRest will generate an error if it is not.

The purpose of this option is to allow offline backups. The pg_xlog directory is copied as-is and archive-check is automatically disabled for the backup.
default: y
example: --no-online
5.2.11
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Sets the timeout, in seconds, that the master 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.
default: 1830
allowed: 0.1-604800
example: --protocol-timeout=630
5.2.12
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
5.2.13
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
5.2.14
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
5.2.15
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
5.2.16
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
5.2.17
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
5.2.18
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
5.2.19
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
5.2.20
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
5.2.21
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
5.3
Log Options
5.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
5.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
5.3.3
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Specifies which log levels must will be 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
default: warn
example: --log-level-stderr=error
5.3.4
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
5.4
Stanza Options
5.4.1
Database Host Command Option (--db-cmd)
pgBackRest exe path on the database host.
Required only if the path to pgbackrest is different on the local and database hosts. If not defined, the database host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --db-cmd=/usr/lib/backrest/bin/pgbackrest
5.4.2
Database Host Configuration Option (--db-config)
pgBackRest database host configuration file.
Sets the location of the configuration file on the database host. This is only required if the database host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --db-config=/etc/pgbackrest_db.conf
5.4.3
Database Host Option (--db-host)
Cluster host for operating remotely via SSH.
Used for backups where the database cluster host is different from the backup host.
example: --db-host=db.domain.com
5.4.4
Database Path Option (--db-path)
Cluster 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 the database cluster it is prudent to set it in case those resources are not available during a restore or offline backup scenario.

The db-path option is tested against the value reported by PostgreSQL on every online backup so it should always be current.
example: --db-path=/data/db
5.4.5
Database Port Option (--db-port)
Cluster port.
Port that PostgreSQL is running on. This usually does not need to be specified as most database clusters run on the default port.
default: 5432
example: --db-port=6543
5.4.6
Database Socket Path Option (--db-socket-path)
Cluster unix socket path.
The unix socket directory that was specified when PostgreSQL was started. pgBackRest will automatically look in the standard location for your OS so there usually no need to specify this setting unless the socket directory was explicitly modified with the unix_socket_directory setting in postgressql.conf.
example: --db-socket-path=/var/run/postgresql
5.4.7
Database User Option (--db-user)
Cluster host logon user when db-host is set.
This user will also own the remote pgBackRest process and will initiate connections to PostgreSQL. For this to work correctly the user should be the PostgreSQL database cluster owner which is generally postgres, the default.
default: postgres
example: --db-user=db_owner
6
Expire Command (expire)
pgBackRest does backup rotation but is not concerned with when the backups were created. If two full backups are configured for retention, pgBackRest will keep two full backups no matter whether they occur two hours or two weeks apart.
6.1
Command Options
6.1.1
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
6.1.2
Archive Retention Option (--retention-archive)
Number of backups worth of continuous WAL to retain.
Note that the 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 retention-full (or retention-diff) value corresponding to the 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 retention-archive-type is set to incr. If disk space is at a premium, then this setting, in conjunction with 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.
allowed: 1-999999999
example: --retention-archive=2
6.1.3
Archive Retention Type Option (--retention-archive-type)
Backup type for WAL retention.
If set to full pgBackRest will keep archive logs for the number of full backups defined by retention-archive. If set to diff (differential) pgBackRest will keep archive logs for the number of full and differential backups defined by retention-archive, meaning if the last backup taken was a full backup, it will be counted as a differential for the purpose of retention. If set to incr (incremental) pgBackRest will keep archive logs for the number of full, differential, and incremental backups defined by 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.
default: full
example: --retention-archive-type=diff
6.1.4
Differential Retention Option (--retention-diff)
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.
allowed: 1-999999999
example: --retention-diff=3
6.1.5
Full Retention Option (--retention-full)
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.
allowed: 1-999999999
example: --retention-full=2
6.2
General Options
6.2.1
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
6.2.2
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
6.2.3
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
6.2.4
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
6.2.5
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
6.2.6
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
6.2.7
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
6.2.8
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
6.2.9
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
6.2.10
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
6.2.11
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
6.2.12
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
6.2.13
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
6.2.14
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
6.3
Log Options
6.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
6.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
6.3.3
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Specifies which log levels must will be 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
default: warn
example: --log-level-stderr=error
6.3.4
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
6.4
Stanza Options
6.4.1
Database Host Command Option (--db-cmd)
pgBackRest exe path on the database host.
Required only if the path to pgbackrest is different on the local and database hosts. If not defined, the database host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --db-cmd=/usr/lib/backrest/bin/pgbackrest
6.4.2
Database Host Configuration Option (--db-config)
pgBackRest database host configuration file.
Sets the location of the configuration file on the database host. This is only required if the database host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --db-config=/etc/pgbackrest_db.conf
6.4.3
Database Host Option (--db-host)
Cluster host for operating remotely via SSH.
Used for backups where the database cluster host is different from the backup host.
example: --db-host=db.domain.com
7
Help Command (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.
8
Info Command (info)
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, however this feature is currently experimental so the format may change between versions.
8.1
Command Options
8.1.1
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
8.1.2
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
8.1.3
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
8.1.4
Backup User Option (--backup-user)
Backup host user when backup-host is set.
Defines the user that will be used for operations on the backup server. Preferably this is not the postgres user but rather some other user like backrest. If PostgreSQL runs on the backup server the postgres user can be placed in the backrest group so it has read permissions on the repository without being able to damage the contents accidentally.
default: backrest
example: --backup-user=backrest
8.1.5
Output Option (--output)
Output format.
The following output types are supported:
  • text - Human-readable summary of backup information.
  • json - Exhaustive machine-readable backup information in JSON format.
default: text
example: --output=json
8.2
General Options
8.2.1
Buffer Size Option (--buffer-size)
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.
default: 4194304
example: --buffer-size=32768
8.2.2
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
8.2.3
Compress Level Option (--compress-level)
Compression level for stored files.
Sets the zlib level to be used for file compression when compress=y.
default: 6
allowed: 0-9
example: --compress-level=9
8.2.4
Network Compress Level Option (--compress-level-network)
Compression level for network transfer when compress=n.
Sets the zlib level to be used for protocol compression when compress=n and the database cluster is not on the same host as the backup. Protocol compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress=y 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.
default: 3
allowed: 0-9
example: --compress-level-network=1
8.2.5
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
8.2.6
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
8.2.7
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
8.2.8
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Sets the timeout, in seconds, that the master 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.
default: 1830
allowed: 0.1-604800
example: --protocol-timeout=630
8.2.9
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
8.2.10
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
8.2.11
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
8.2.12
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
8.2.13
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
8.2.14
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
8.2.15
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
8.2.16
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
8.2.17
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
8.2.18
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
8.3
Log Options
8.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
8.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
8.3.3
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Specifies which log levels must will be 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
default: warn
example: --log-level-stderr=error
8.3.4
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
9
Restore Command (restore)
This command is generally run manually, but there are instances where it might be automated.
9.1
Command Options
9.1.1
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
9.1.2
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
9.1.3
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
9.1.4
Backup User Option (--backup-user)
Backup host user when backup-host is set.
Defines the user that will be used for operations on the backup server. Preferably this is not the postgres user but rather some other user like backrest. If PostgreSQL runs on the backup server the postgres user can be placed in the backrest group so it has read permissions on the repository without being able to damage the contents accidentally.
default: backrest
example: --backup-user=backrest
9.1.5
Include Database Option (--db-include)
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 PostgreSQL to perform recovery. After recovery the databases that were not included will not be accessible but can be removed with the drop database command.

Note that built-in databases (template0, template1, and postgres) are always restored.

The --db-include option can be passed multiple times to specify more than one database to include.
example: --db-include=db_main
9.1.6
Delta Option (--delta)
Restore using delta.
By default the PostgreSQL data and tablespace directories are expected to be present but empty. This option performs a delta restore using checksums.
default: n
example: --delta
9.1.7
Force Option (--force)
Force a restore.
By itself this option forces the PostgreSQL data and tablespace paths to be completely overwritten. In combination with --delta a timestamp/size delta will be performed instead of using checksums.
default: n
example: --force
9.1.8
Link All Option (--link-all)
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.
default: n
example: --link-all
9.1.9
Link Map Option (--link-map)
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.
example: --link-map=pg_xlog=/data/xlog
9.1.10
Recovery Option Option (--recovery-option)
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 PostgreSQL version). This option can be used multiple times.

Note: The restore_command option will be automatically generated but can be overridden with this option. Be careful about specifying your own restore_command as pgBackRest is designed to handle this for you. Target Recovery options (recovery_target_name, recovery_target_time, etc.) are generated automatically by pgBackRest and should not be set with this option.

Since pgBackRest does not start PostgreSQL after writing the recovery.conf file, it is always possible to edit/check recovery.conf before manually restarting.
example: --recovery-option=primary_conninfo=db.mydomain.com
9.1.11
Set Option (--set)
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.
default: latest
example: --set=20150131-153358F_20150131-153401I
9.1.12
Tablespace Map Option (--tablespace-map)
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 PostgreSQL 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.
example: --tablespace-map=ts_01=/db/ts_01
9.1.13
Map All Tablespaces Option (--tablespace-map-all)
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.
example: --tablespace-map-all=/data/tablespace
9.1.14
Target Option (--target)
Recovery target.
Defines the recovery target when --type is name, xid, or time.
example: --target=2015-01-30 14:15:11 EST
9.1.15
Target Action Option (--target-action)
Action to take when recovery target is reached.
The following actions are supported:
  • pause - pause when recovery target is reached.
  • promote - promote and switch timeline when recovery target is reached.
  • shutdown - shutdown server when recovery target is reached.
This option is only supported on PostgreSQL >= 9.5.
default: pause
example: --target-action=promote
9.1.16
Target Exclusive Option (--target-exclusive)
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 PostgreSQL docs for more information.
default: n
example: --no-target-exclusive
9.1.17
Target Timeline Option (--target-timeline)
Recover along a timeline.
See recovery_target_timeline in the PostgreSQL docs for more information.
example: --target-timeline=3
9.1.18
Type Option (--type)
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 PostgreSQL >= 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.
  • none - no recovery.conf file is written so PostgreSQL will attempt to achieve consistency using WAL segments present in pg_xlog. Provide the required WAL segments or use the archive-copy setting to include them with the backup.
default: default
example: --type=xid
9.2
General Options
9.2.1
Buffer Size Option (--buffer-size)
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.
default: 4194304
example: --buffer-size=32768
9.2.2
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
9.2.3
Compress Option (--compress)
Use gzip file compression.
Backup files are compatible with command-line gzip tools.
default: y
example: --no-compress
9.2.4
Compress Level Option (--compress-level)
Compression level for stored files.
Sets the zlib level to be used for file compression when compress=y.
default: 6
allowed: 0-9
example: --compress-level=9
9.2.5
Network Compress Level Option (--compress-level-network)
Compression level for network transfer when compress=n.
Sets the zlib level to be used for protocol compression when compress=n and the database cluster is not on the same host as the backup. Protocol compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress=y 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.
default: 3
allowed: 0-9
example: --compress-level-network=1
9.2.6
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
9.2.7
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
9.2.8
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
9.2.9
Neutral Umask Option (--neutral-umask)
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.
default: y
example: --no-neutral-umask
9.2.10
Process Maximum Option (--process-max)
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.
default: 1
allowed: 1-96
example: --process-max=4
9.2.11
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Sets the timeout, in seconds, that the master 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.
default: 1830
allowed: 0.1-604800
example: --protocol-timeout=630
9.2.12
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
9.2.13
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
9.2.14
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
9.2.15
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
9.2.16
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
9.2.17
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
9.2.18
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
9.2.19
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
9.2.20
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
9.2.21
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
9.3
Log Options
9.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
9.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
9.3.3
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Specifies which log levels must will be 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
default: warn
example: --log-level-stderr=error
9.3.4
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
9.4
Stanza Options
9.4.1
Database Path Option (--db-path)
Cluster 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 the database cluster it is prudent to set it in case those resources are not available during a restore or offline backup scenario.

The db-path option is tested against the value reported by PostgreSQL on every online backup so it should always be current.
example: --db-path=/data/db
10
Stanza Create Command (stanza-create)
The stanza-create command must be run on the host where the repository is located after the stanza has been configured in pgbackrest.conf.
10.1
Command Options
10.1.1
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
10.1.2
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
10.1.3
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
10.1.4
Backup from Standby Option (--backup-standby)
Backup from the standby cluster.
Enable backup from standby to reduce load on the master cluster. This option requires that both the master and standby hosts be configured.
default: n
example: --backup-standby
10.1.5
Backup User Option (--backup-user)
Backup host user when backup-host is set.
Defines the user that will be used for operations on the backup server. Preferably this is not the postgres user but rather some other user like backrest. If PostgreSQL runs on the backup server the postgres user can be placed in the backrest group so it has read permissions on the repository without being able to damage the contents accidentally.
default: backrest
example: --backup-user=backrest
10.1.6
Force Option (--force)
Force stanza creation.
If the required stanza information does not exist in the repository but backups or WAL segments do exist, then this option can be used to force the stanza to be created from the existing data in the repository. This is most likely to be useful after corruption or an incomplete restore of the repository from elsewhere.
default: n
example: --no-force
10.2
General Options
10.2.1
Buffer Size Option (--buffer-size)
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.
default: 4194304
example: --buffer-size=32768
10.2.2
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
10.2.3
Compress Level Option (--compress-level)
Compression level for stored files.
Sets the zlib level to be used for file compression when compress=y.
default: 6
allowed: 0-9
example: --compress-level=9
10.2.4
Network Compress Level Option (--compress-level-network)
Compression level for network transfer when compress=n.
Sets the zlib level to be used for protocol compression when compress=n and the database cluster is not on the same host as the backup. Protocol compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress=y 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.
default: 3
allowed: 0-9
example: --compress-level-network=1
10.2.5
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
10.2.6
Database Timeout Option (--db-timeout)
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).
default: 1800
allowed: 0.1-604800
example: --db-timeout=600
10.2.7
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
10.2.8
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
10.2.9
Neutral Umask Option (--neutral-umask)
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.
default: y
example: --no-neutral-umask
10.2.10
Online Option (--online)
Perform an online backup.
Specifying --no-online prevents pgBackRest from running pg_start_backup() and pg_stop_backup() on the database cluster. In order for this to work PostgreSQL should be shut down and pgBackRest will generate an error if it is not.

The purpose of this option is to allow offline backups. The pg_xlog directory is copied as-is and archive-check is automatically disabled for the backup.
default: y
example: --no-online
10.2.11
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Sets the timeout, in seconds, that the master 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.
default: 1830
allowed: 0.1-604800
example: --protocol-timeout=630
10.2.12
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
10.2.13
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
10.2.14
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
10.2.15
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
10.2.16
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
10.2.17
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
10.2.18
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
10.2.19
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
10.2.20
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
10.2.21
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
10.3
Log Options
10.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
10.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
10.3.3
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
10.4
Stanza Options
10.4.1
Database Host Command Option (--db-cmd)
pgBackRest exe path on the database host.
Required only if the path to pgbackrest is different on the local and database hosts. If not defined, the database host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --db-cmd=/usr/lib/backrest/bin/pgbackrest
10.4.2
Database Host Configuration Option (--db-config)
pgBackRest database host configuration file.
Sets the location of the configuration file on the database host. This is only required if the database host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --db-config=/etc/pgbackrest_db.conf
10.4.3
Database Host Option (--db-host)
Cluster host for operating remotely via SSH.
Used for backups where the database cluster host is different from the backup host.
example: --db-host=db.domain.com
10.4.4
Database Path Option (--db-path)
Cluster 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 the database cluster it is prudent to set it in case those resources are not available during a restore or offline backup scenario.

The db-path option is tested against the value reported by PostgreSQL on every online backup so it should always be current.
example: --db-path=/data/db
10.4.5
Database Port Option (--db-port)
Cluster port.
Port that PostgreSQL is running on. This usually does not need to be specified as most database clusters run on the default port.
default: 5432
example: --db-port=6543
10.4.6
Database Socket Path Option (--db-socket-path)
Cluster unix socket path.
The unix socket directory that was specified when PostgreSQL was started. pgBackRest will automatically look in the standard location for your OS so there usually no need to specify this setting unless the socket directory was explicitly modified with the unix_socket_directory setting in postgressql.conf.
example: --db-socket-path=/var/run/postgresql
10.4.7
Database User Option (--db-user)
Cluster host logon user when db-host is set.
This user will also own the remote pgBackRest process and will initiate connections to PostgreSQL. For this to work correctly the user should be the PostgreSQL database cluster owner which is generally postgres, the default.
default: postgres
example: --db-user=db_owner
11
Stanza Upgrade Command (stanza-upgrade)
Immediately after upgrading PostgreSQL to a newer major version, the db-path for all pgBackRest configurations must be set to the new database location and the stanza-upgrade run on the backup host. If the database is offline use the --no-online option.
11.1
Command Options
11.1.1
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
11.1.2
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
11.1.3
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
11.1.4
Backup from Standby Option (--backup-standby)
Backup from the standby cluster.
Enable backup from standby to reduce load on the master cluster. This option requires that both the master and standby hosts be configured.
default: n
example: --backup-standby
11.2
General Options
11.2.1
Buffer Size Option (--buffer-size)
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.
default: 4194304
example: --buffer-size=32768
11.2.2
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
11.2.3
Compress Level Option (--compress-level)
Compression level for stored files.
Sets the zlib level to be used for file compression when compress=y.
default: 6
allowed: 0-9
example: --compress-level=9
11.2.4
Network Compress Level Option (--compress-level-network)
Compression level for network transfer when compress=n.
Sets the zlib level to be used for protocol compression when compress=n and the database cluster is not on the same host as the backup. Protocol compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress=y 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.
default: 3
allowed: 0-9
example: --compress-level-network=1
11.2.5
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
11.2.6
Database Timeout Option (--db-timeout)
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).
default: 1800
allowed: 0.1-604800
example: --db-timeout=600
11.2.7
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
11.2.8
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
11.2.9
Neutral Umask Option (--neutral-umask)
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.
default: y
example: --no-neutral-umask
11.2.10
Online Option (--online)
Perform an online backup.
Specifying --no-online prevents pgBackRest from running pg_start_backup() and pg_stop_backup() on the database cluster. In order for this to work PostgreSQL should be shut down and pgBackRest will generate an error if it is not.

The purpose of this option is to allow offline backups. The pg_xlog directory is copied as-is and archive-check is automatically disabled for the backup.
default: y
example: --no-online
11.2.11
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Sets the timeout, in seconds, that the master 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.
default: 1830
allowed: 0.1-604800
example: --protocol-timeout=630
11.2.12
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
11.2.13
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
11.2.14
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
11.2.15
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
11.2.16
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
11.2.17
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
11.2.18
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
11.2.19
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
11.2.20
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
11.2.21
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
11.3
Log Options
11.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
11.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
11.4
Stanza Options
11.4.1
Database Host Command Option (--db-cmd)
pgBackRest exe path on the database host.
Required only if the path to pgbackrest is different on the local and database hosts. If not defined, the database host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --db-cmd=/usr/lib/backrest/bin/pgbackrest
11.4.2
Database Host Configuration Option (--db-config)
pgBackRest database host configuration file.
Sets the location of the configuration file on the database host. This is only required if the database host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --db-config=/etc/pgbackrest_db.conf
11.4.3
Database Host Option (--db-host)
Cluster host for operating remotely via SSH.
Used for backups where the database cluster host is different from the backup host.
example: --db-host=db.domain.com
11.4.4
Database Path Option (--db-path)
Cluster 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 the database cluster it is prudent to set it in case those resources are not available during a restore or offline backup scenario.

The db-path option is tested against the value reported by PostgreSQL on every online backup so it should always be current.
example: --db-path=/data/db
11.4.5
Database Port Option (--db-port)
Cluster port.
Port that PostgreSQL is running on. This usually does not need to be specified as most database clusters run on the default port.
default: 5432
example: --db-port=6543
11.4.6
Database Socket Path Option (--db-socket-path)
Cluster unix socket path.
The unix socket directory that was specified when PostgreSQL was started. pgBackRest will automatically look in the standard location for your OS so there usually no need to specify this setting unless the socket directory was explicitly modified with the unix_socket_directory setting in postgressql.conf.
example: --db-socket-path=/var/run/postgresql
11.4.7
Database User Option (--db-user)
Cluster host logon user when db-host is set.
This user will also own the remote pgBackRest process and will initiate connections to PostgreSQL. For this to work correctly the user should be the PostgreSQL database cluster owner which is generally postgres, the default.
default: postgres
example: --db-user=db_owner
12
Start Command (start)
If the pgBackRest 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 pgBackRest processes but they are allowed to run.
12.1
Command Options
12.1.1
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
12.1.2
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
12.1.3
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
12.1.4
Backup User Option (--backup-user)
Backup host user when backup-host is set.
Defines the user that will be used for operations on the backup server. Preferably this is not the postgres user but rather some other user like backrest. If PostgreSQL runs on the backup server the postgres user can be placed in the backrest group so it has read permissions on the repository without being able to damage the contents accidentally.
default: backrest
example: --backup-user=backrest
12.2
General Options
12.2.1
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
12.2.2
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
12.2.3
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
12.2.4
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
12.2.5
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
12.2.6
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
12.2.7
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
12.2.8
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
12.2.9
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
12.2.10
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
12.2.11
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
12.2.12
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
12.2.13
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
12.2.14
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
12.3
Log Options
12.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
12.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
12.3.3
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Specifies which log levels must will be 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
default: warn
example: --log-level-stderr=error
12.3.4
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
12.4
Stanza Options
12.4.1
Database Host Command Option (--db-cmd)
pgBackRest exe path on the database host.
Required only if the path to pgbackrest is different on the local and database hosts. If not defined, the database host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --db-cmd=/usr/lib/backrest/bin/pgbackrest
12.4.2
Database Host Configuration Option (--db-config)
pgBackRest database host configuration file.
Sets the location of the configuration file on the database host. This is only required if the database host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --db-config=/etc/pgbackrest_db.conf
12.4.3
Database Host Option (--db-host)
Cluster host for operating remotely via SSH.
Used for backups where the database cluster host is different from the backup host.
example: --db-host=db.domain.com
13
Stop Command (stop)
Does not allow any new pgBackRest processes to run. By default running processes will be allowed to complete successfully. Use the --force option to terminate running processes.

pgBackRest processes will return an error if they are run after the stop command completes.
13.1
Command Options
13.1.1
Backup Host Command Option (--backup-cmd)
pgBackRest exe path on the backup host.
Required only if the path to pgbackrest is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --backup-cmd=/usr/lib/backrest/bin/pgbackrest
13.1.2
Backup Host Configuration Option (--backup-config)
pgBackRest backup host configuration file.
Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --backup-config=/etc/pgbackrest_backup.conf
13.1.3
Backup Host Option (--backup-host)
Backup host when operating remotely via SSH.
Make sure that trusted SSH authentication is configured between the db host and the backup host.

When backing up to a locally mounted network filesystem this setting is not required.
example: --backup-host=backup.domain.com
13.1.4
Backup User Option (--backup-user)
Backup host user when backup-host is set.
Defines the user that will be used for operations on the backup server. Preferably this is not the postgres user but rather some other user like backrest. If PostgreSQL runs on the backup server the postgres user can be placed in the backrest group so it has read permissions on the repository without being able to damage the contents accidentally.
default: backrest
example: --backup-user=backrest
13.1.5
Force Option (--force)
Force all pgBackRest processes to stop.
This option will send TERM signals to all running pgBackRest 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.
default: n
example: --force
13.2
General Options
13.2.1
SSH client command Option (--cmd-ssh)
Path to ssh client executable.
Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH.
default: ssh
example: --cmd-ssh=/usr/bin/ssh
13.2.2
Config Option (--config)
pgBackRest configuration file.
Use this option to specify a different configuration file than the default.
default: /etc/pgbackrest.conf
example: --config=/var/lib/backrest/pgbackrest.conf
13.2.3
Lock Path Option (--lock-path)
Path where lock files are stored.
The lock path provides a location for pgBackRest to create lock files to prevent conflicting operations from being run concurrently.
default: /tmp/pgbackrest
example: --lock-path=/backup/db/lock
13.2.4
Log Path Option (--log-path)
Path where log files are stored.
The log path provides a location for pgBackRest to store log files. Note that if log-level-file=none then no log path is required.
default: /var/log/pgbackrest
example: --log-path=/backup/db/log
13.2.5
Repository Path Option (--repo-path)
Repository path where WAL segments and backups stored.
The repository is where pgBackRest stores backup and archives WAL segments.

If you are new to backup then it will 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.
default: /var/lib/pgbackrest
example: --repo-path=/backup/db/backrest
13.2.6
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.

pgBackRest 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.
example: --repo-s3-bucket=db-backup
13.2.7
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS end point should be valid for the selected region.
example: --repo-s3-endpoint=s3.amazonaws.com
13.2.8
S3 Repository Host Option (--repo-s3-host)
S3 repository host.
Connect to a host other than the end point. This is typically used for testing.
example: --repo-s3-host=127.0.0.1
13.2.9
S3 Repository Access Key Option (--repo-s3-key)
S3 repository access key.
AWS key used to access this bucket.
example: --repo-s3-key=AKIAIOSFODNN7EXAMPLE
13.2.10
S3 Repository Secret Access Key Option (--repo-s3-key-secret)
S3 repository secret access key.
AWS secret key used to access this bucket.
example: --repo-s3-key-secret=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
13.2.11
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
example: --repo-s3-region=us-east-1
13.2.12
S3 Repository Verify SSL Option (--repo-s3-verify-ssl)
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.
default: y
example: --no-repo-s3-verify-ssl
13.2.13
Repository Type Option (--repo-type)
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
default: posix
example: --repo-type=cifs
13.2.14
Stanza Option (--stanza)
Defines a stanza.
A stanza is the configuration for a PostgreSQL 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.
example: --stanza=main
13.3
Log Options
13.3.1
Console Log Level Option (--log-level-console)
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
default: warn
example: --log-level-console=error
13.3.2
File Log Level Option (--log-level-file)
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
default: info
example: --log-level-file=debug
13.3.3
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Specifies which log levels must will be 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
default: warn
example: --log-level-stderr=error
13.3.4
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
default: y
example: --no-log-timestamp
13.4
Stanza Options
13.4.1
Database Host Command Option (--db-cmd)
pgBackRest exe path on the database host.
Required only if the path to pgbackrest is different on the local and database hosts. If not defined, the database host exe path will be set the same as the local exe path.
default: [INSTALL-PATH]/pgbackrest
example: --db-cmd=/usr/lib/backrest/bin/pgbackrest
13.4.2
Database Host Configuration Option (--db-config)
pgBackRest database host configuration file.
Sets the location of the configuration file on the database host. This is only required if the database host configuration file is in a different location than the local configuration file.
default: /etc/pgbackrest.conf
example: --db-config=/etc/pgbackrest_db.conf
13.4.3
Database Host Option (--db-host)
Cluster host for operating remotely via SSH.
Used for backups where the database cluster host is different from the backup host.
example: --db-host=db.domain.com
14
Version Command (version)
Displays installed pgBackRest version.