This is the multi-page printable view of this section. .
Command Reference
- 1: Annotate Command (annotate)
- 2: Archive Get Command (archive-get)
- 3: Archive Push Command (archive-push)
- 4: Backup Command (backup)
- 5: Check Command (check)
- 6: Expire Command (expire)
- 7: Help Command (help)
- 8: Info Command (info)
- 9: Repository Get Command (repo-get)
- 10: Repository List Command (repo-ls)
- 11: Restore Command (restore)
- 12: Server Command (server)
- 13: Server Ping Command (server-ping)
- 14: Stanza Create Command (stanza-create)
- 15: Stanza Delete Command (stanza-delete)
- 16: Stanza Upgrade Command (stanza-upgrade)
- 17: Start Command (start)
- 18: Stop Command (stop)
- 19: Verify Command (verify)
- 20: Version Command (version)
Introduction
Commands execute pgBackRest functions. Each command page lists every applicable option, including options shared with other commands. The lists also include options that you can set in pgbackrest.conf.
Use the reset- prefix on the command line to reset a non-boolean option from pgbackrest.conf to its default. For example, use this feature to restore a backup directly on a repository host. Normally, pgBackRest detects the remote database host and reports an error because remote restores are not supported. Add --reset-pg1-host to ignore the remote database host and restore locally. You might also need --pg1-path to select a path other than the database host path.
Use the no- prefix on the command line to set a boolean option to false.
To set an option through an environment variable, add the PGBACKREST_ prefix. Convert the option name to uppercase and replace - with _. For example, pg1-path becomes PGBACKREST_PG1_PATH, and stanza becomes PGBACKREST_STANZA. Use configuration-file values for boolean options, such as PGBACKREST_COMPRESS="n"; reset-* variants are not permitted. For an option that accepts multiple values on the command line or in a configuration file, separate values with colons. For example, use PGBACKREST_DB_INCLUDE="db1:db2".
Command-line options override environment options. Environment options override configuration-file options.
See Configuration Introduction for information about option types.
Commands
| Command | Summary |
|---|---|
annotate | Add, modify, or remove backup annotations after the backup is created. |
archive-get | Fetch archived WAL segments for restore, PITR, or replica recovery. |
archive-push | Accept WAL segments from PostgreSQL and push them to configured repositories. |
backup | Create backups to the target repository (defaults to highest priority repository). |
check | Validate stanza backup/archive configuration and WAL archiving health. |
expire | Expire backups and archived WAL based on configured retention policies. |
help | Show command and option help at general, command, or option level. |
info | Display stanza and backup status/metadata in text or JSON format. |
repo-get | Read repository files (like cat) for administration, investigation, and testing. |
repo-ls | List repository files/paths (like ls) for administration, investigation, and testing. |
restore | Restore from backup (latest by default) with optional point-in-time recovery. |
server | Run the pgBackRest TLS server for remote host access without SSH. |
server-ping | Ping a pgBackRest TLS server to verify it is accepting connections. |
stanza-create | Create stanza metadata in all configured repositories. |
stanza-delete | Permanently remove all backups and archives for a stanza. |
stanza-upgrade | Upgrade stanza metadata after a PostgreSQL major version upgrade. |
start | Re-allow pgBackRest processes to run after a previous stop. |
stop | Prevent new pgBackRest processes and optionally force-stop running ones. |
verify | Verify that backup and archive data in the repository is valid. |
version | Display the installed pgBackRest version. |
1 - Annotate Command (annotate)
annotate command options and behavior.Use annotate to add, change, or remove annotations after the backup command creates a backup.
Command Options
Backup Annotation Option (--annotation)
Annotate backup with user-defined key/value pairs.
Attach informative key/value pairs to the backup. Repeat this option to attach multiple annotations.
When --set specifies a backup, the info command includes its annotations in text output. JSON output always includes annotations.
Set Option (--set)
Backup set to annotate.
The backup set to annotate.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
2 - Archive Get Command (archive-get)
archive-get command options and behavior.PostgreSQL uses this command to restore a backup or perform PITR. It can also use the command instead of streaming to keep a replica current. PostgreSQL needs WAL segments for recovery and replica maintenance.
With multiple repositories, pgBackRest searches for WAL in priority order, such as repo1, then repo2. Usually, give faster or cheaper storage higher priority. If --repo specifies a repository, pgBackRest searches only that repository.
During a restore, pgBackRest generates and configures the archive-get command for PostgreSQL. See the example in Point-in-Time Recovery.
Command Options
Asynchronous Archiving Option (--archive-async)
Push/get WAL segments asynchronously.
Enables asynchronous operation for the archive-push and archive-get commands.
Asynchronous operation can reuse connections and process work in parallel, which improves efficiency. See spool-path, archive-get-queue-max, and archive-push-queue-max for more information.
Maximum Archive Get Queue Size Option (--archive-get-queue-max)
Maximum size of the pgBackRest archive-get queue.
When archive-async is enabled, set the maximum archive-get queue size. pgBackRest stores the queue in spool-path to supply WAL to PostgreSQL faster.
Retry Missing WAL Segment Option (--archive-missing-retry)
Retry missing WAL segment
In asynchronous mode, retry a WAL segment that archive-get previously reported as missing. This prevents reuse of spool-path notifications from an earlier restore. Such notifications could cause recovery to fail before consistency is reached.
Disable this option to help PostgreSQL reliably detect the end of archived WAL and switch to streaming from the primary. With retries enabled, a continuous flow of archived WAL keeps PostgreSQL reading the archive instead of switching to streaming.
Before you disable this option, make sure the stanza spool path is empty. The restore command empties it automatically if the spool path is configured at restore time. Otherwise, empty it yourself.
Archive Timeout Option (--archive-timeout)
Archive timeout.
Set the maximum wait, in seconds, for each WAL segment to reach the pgBackRest archive repository. The check and backup commands use this timeout while waiting for WAL segments necessary for backup consistency.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
pgBackRest Command Option (--cmd)
pgBackRest command.
pgBackRest can generate a command string, for example when restore generates the restore_command setting. It uses the command that started the pgBackRest process unless you specify the cmd option.
CAUTION:
Wrapping the pgBackRest command may cause unpredictable behavior and is not recommended.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Process Maximum Option (--process-max)
Max processes to use for compress/transfer.
Each process compresses and transfers data to increase command speed. Do not set process-max so high that database performance decreases.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Spool Path Option (--spool-path)
Path where transient data is stored.
This path stores data for asynchronous archive-push and archive-get commands.
After it stores WAL in the archive, asynchronous archive-push writes an acknowledgement in the spool path. On failure, it writes an error. The foreground process can then notify PostgreSQL quickly. Acknowledgement files contain zero bytes on success and a few hundred bytes on error.
Asynchronous archive-get queues WAL in the spool path to supply it quickly when PostgreSQL requests it. Transfers are most efficient when the spool path uses the same filesystem as pg_xlog/pg_wal. However, do not put the spool path inside pg_xlog/pg_wal. This can cause problems for PostgreSQL utilities, such as pg_rewind.
Spool-path data can and should survive a reboot. However, loss of this data does not cause a problem. For archive-push, pgBackRest checks again that each WAL segment is safely archived. For archive-get, it rebuilds the queue.
Use a local Posix-compatible filesystem for the spool path. It is not intended for remote filesystems, such as NFS or CIFS.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Maintainer Options
Force PostgreSQL Version Option (--pg-version-force)
Force PostgreSQL version.
Use the specified PostgreSQL version instead of the version detected from pg_control or WAL headers. This is mainly useful for PostgreSQL forks or development versions whose values differ from the release version. The version that PostgreSQL reports through server_version_num must match the forced version.
WARNING:
Use this option with care. pgBackRest still reads pg_control and WAL headers in the official open-source PostgreSQL format for the specified version. Changes to fields that pgBackRest uses can cause unexpected behavior. Generally, the fork must add all custom struct members after the standard PostgreSQL members for this option to work correctly.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Target Time for Repository Option (--repo-target-time)
Target time for repository.
Set the point in time at which commands read a repository on versioned storage. This lets you recover data deleted or corrupted by user error or malware.
S3, GCS, and Azure support versioned storage, but usually disable it by default. In addition to versioning, consider S3 object locking or GCS and Azure soft delete.
When you specify repo-target-time, you must also specify repo. Some repository types probably will not support versioning. Recovery usually targets one repository.
Storage timestamps must be <= the specified timestamp. pgBackRest truncates milliseconds from the specified timestamp.
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
Stanza Options
PostgreSQL Path Option (--pg-path)
PostgreSQL data directory.
Use the data_directory value reported by PostgreSQL. Other sources can provide this value, but they might be unavailable during a restore or offline backup. Set it here as a precaution.
Each online backup compares pg-path with the value reported by PostgreSQL. Thus, this setting should stay current.
Deprecated Name: db-path
3 - Archive Push Command (archive-push)
archive-push command options and behavior.This command accepts a WAL segment from PostgreSQL. It archives the segment in each repository defined by an indexed repo-path option. See Repository for configuration details. The archive-async value determines whether pgBackRest immediately archives the segment or stores it locally first. With multiple repositories, archive-push attempts to write to as many as possible.
Configure PostgreSQL to call archive-push. See the example in Configure Archiving.
Command Options
Asynchronous Archiving Option (--archive-async)
Push/get WAL segments asynchronously.
Enables asynchronous operation for the archive-push and archive-get commands.
Asynchronous operation can reuse connections and process work in parallel, which improves efficiency. See spool-path, archive-get-queue-max, and archive-push-queue-max for more information.
Check Archive Option (--archive-check)
Check that WAL segments are in the archive before backup completes.
Check that the WAL archive contains all segments necessary for backup consistency. Keep the default unless you use another archive method.
This option must be enabled if archive-copy is enabled.
Check Archive Mode Option (--archive-mode-check)
Check the PostgreSQL archive_mode setting.
Enabled by default, this option disallows PostgreSQL archive_mode=always.
A standby can push WAL segments with the same logical contents as primary segments but different checksums. Disable archiving from multiple sources to avoid these conflicts.
CAUTION:
If you disable this option, make sure that only one archiver writes to the repository through archive-push.
Archive Push Batch Size Option (--archive-push-batch-size)
Maximum amount of WAL to push per asynchronous run.
In asynchronous mode, each archive-push run processes all WAL segments that are ready. It checks archive-push-queue-max only at the start. A large run can let the queue grow far past the limit before the next check.
Set the amount of WAL to process per run. The process then exits, and the next archive-push starts it again and checks the queue. Lower values check the queue more often but start the asynchronous process more frequently. pgBackRest rounds the value down to a whole number of WAL segments. It always processes at least one segment.
Maximum Archive Push Queue Size Option (--archive-push-queue-max)
Maximum size of the PostgreSQL archive queue.
When the queue reaches the limit:
- pgBackRest tells PostgreSQL that it archived the WAL successfully, then DROPS IT.
- PostgreSQL logs a warning.
This interrupts the archive log stream. PITR cannot continue past this point. Take a new backup to restore full recovery capability.
In asynchronous mode, pgBackRest drops the entire queue. This prevents brief WAL transfers before the queue exceeds the limit again.
In asynchronous mode, each archive-push run checks this limit only at the start. The queue can exceed it during the run. Reduce archive-push-batch-size to check more often.
This feature prevents WAL from filling the log volume, which would stop PostgreSQL completely. It sacrifices backup continuity to keep PostgreSQL running.
Deprecated Name: archive-queue-max
Archive Timeout Option (--archive-timeout)
Archive timeout.
Set the maximum wait, in seconds, for each WAL segment to reach the pgBackRest archive repository. The check and backup commands use this timeout while waiting for WAL segments necessary for backup consistency.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
pgBackRest Command Option (--cmd)
pgBackRest command.
pgBackRest can generate a command string, for example when restore generates the restore_command setting. It uses the command that started the pgBackRest process unless you specify the cmd option.
CAUTION:
Wrapping the pgBackRest command may cause unpredictable behavior and is not recommended.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Compress Option (--compress)
Use file compression.
Backup files are compatible with command-line compression tools.
This option is deprecated. Use compress-type instead.
Compress Level Option (--compress-level)
File compression level.
Set the file compression level when compress-type is not none or when compress=y (deprecated).
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Compress Type Option (--compress-type)
File compression type.
The following compression types are supported:
none- no compressionbz2- bzip2 compression formatgz- gzip compression formatlz4- lz4 compression format (not available on all platforms)zst- Zstandard compression format (not available on all platforms)
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Process Maximum Option (--process-max)
Max processes to use for compress/transfer.
Each process compresses and transfers data to increase command speed. Do not set process-max so high that database performance decreases.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Spool Path Option (--spool-path)
Path where transient data is stored.
This path stores data for asynchronous archive-push and archive-get commands.
After it stores WAL in the archive, asynchronous archive-push writes an acknowledgement in the spool path. On failure, it writes an error. The foreground process can then notify PostgreSQL quickly. Acknowledgement files contain zero bytes on success and a few hundred bytes on error.
Asynchronous archive-get queues WAL in the spool path to supply it quickly when PostgreSQL requests it. Transfers are most efficient when the spool path uses the same filesystem as pg_xlog/pg_wal. However, do not put the spool path inside pg_xlog/pg_wal. This can cause problems for PostgreSQL utilities, such as pg_rewind.
Spool-path data can and should survive a reboot. However, loss of this data does not cause a problem. For archive-push, pgBackRest checks again that each WAL segment is safely archived. For archive-get, it rebuilds the queue.
Use a local Posix-compatible filesystem for the spool path. It is not intended for remote filesystems, such as NFS or CIFS.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Maintainer Options
Check WAL Headers Option (--archive-header-check)
Check PostgreSQL version/id in WAL headers.
This option is enabled by default. It compares WAL headers with the PostgreSQL version and system identifier to check that WAL goes to the correct stanza. pgBackRest also checks pg_control against the stanza. It verifies that WAL comes from the PostgreSQL data directory that contains pg_control.
Thus, disabling this check is relatively safe. Disable it only when necessary, for example for encrypted WAL.
Force PostgreSQL Version Option (--pg-version-force)
Force PostgreSQL version.
Use the specified PostgreSQL version instead of the version detected from pg_control or WAL headers. This is mainly useful for PostgreSQL forks or development versions whose values differ from the release version. The version that PostgreSQL reports through server_version_num must match the forced version.
WARNING:
Use this option with care. pgBackRest still reads pg_control and WAL headers in the official open-source PostgreSQL format for the specified version. Changes to fields that pgBackRest uses can cause unexpected behavior. Generally, the fork must add all custom struct members after the standard PostgreSQL members for this option to work correctly.
Repository Options
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
Stanza Options
PostgreSQL Path Option (--pg-path)
PostgreSQL data directory.
Use the data_directory value reported by PostgreSQL. Other sources can provide this value, but they might be unavailable during a restore or offline backup. Set it here as a precaution.
Each online backup compares pg-path with the value reported by PostgreSQL. Thus, this setting should stay current.
Deprecated Name: db-path
4 - Backup Command (backup)
backup command options and behavior.Source: pgBackRest Command Docs: backup
With multiple repositories, pgBackRest backs up to the highest priority repository, such as repo1. Use --repo to select another repository.
pgBackRest has no built-in scheduler. Use cron or another scheduler to run it.
See Perform a Backup for more details and examples.
Command Options
Backup Annotation Option (--annotation)
Annotate backup with user-defined key/value pairs.
Attach informative key/value pairs to the backup. Repeat this option to attach multiple annotations.
When --set specifies a backup, the info command includes its annotations in text output. JSON output always includes annotations.
Check Archive Option (--archive-check)
Check that WAL segments are in the archive before backup completes.
Check that the WAL archive contains all segments necessary for backup consistency. Keep the default unless you use another archive method.
This option must be enabled if archive-copy is enabled.
Copy Archive Option (--archive-copy)
Copy WAL segments needed for consistency to the backup.
Store WAL segments necessary for consistency directly in the backup. This protects against corruption in the WAL archive. The archive still stores these segments, so this option uses additional space.
When you use this option, give archive-push and backup the same compress-type, such as lz4. Otherwise, pgBackRest must recompress WAL segments with the backup compression type. This can require substantial processing when the backup generates a large amount of WAL.
After a restore, these WAL segments are in pg_xlog/pg_wal. PostgreSQL uses them before it calls restore_command.
The archive-check option must be enabled if archive-copy is enabled.
Check Archive Mode Option (--archive-mode-check)
Check the PostgreSQL archive_mode setting.
Enabled by default, this option disallows PostgreSQL archive_mode=always.
A standby can push WAL segments with the same logical contents as primary segments but different checksums. Disable archiving from multiple sources to avoid these conflicts.
CAUTION:
If you disable this option, make sure that only one archiver writes to the repository through archive-push.
Archive Timeout Option (--archive-timeout)
Archive timeout.
Set the maximum wait, in seconds, for each WAL segment to reach the pgBackRest archive repository. The check and backup commands use this timeout while waiting for WAL segments necessary for backup consistency.
Backup from Standby Option (--backup-standby)
Backup from the standby cluster.
Enable backups from the standby to reduce primary cluster load. Configure both the primary and standby hosts to use this option.
The following modes are supported:
y- Standby is required for backup.prefer- Backup from standby if available otherwise backup from primary.n- Backup from primary only.
Page Checksums Option (--checksum-page)
Validate data page checksums.
Validate all data page checksums during a cluster backup. pgBackRest enables this option automatically when the cluster has data page checksums enabled.
Checksum validation failures do not stop a backup. pgBackRest writes warnings to the log and, with default settings, the console. It stores the invalid page list in the backup manifest.
Path/File Exclusions Option (--exclude)
Exclude paths/files from the backup.
All exclusions are relative to $PGDATA. An exclusion ending in / excludes files in the directory but keeps the directory itself. For example, --exclude=junk/ excludes files in $PGDATA/junk. Without a final /, an exclusion matches either the exact file name or the name followed by /. For example, --exclude=junk excludes the $PGDATA/junk directory and all its files.
Use this feature with care. An excluded critical file can make the backup inconsistent. Test your restores.
pgBackRest logs each excluded file and its exclusion rule at info level. Review the list to make sure all exclusions are intended.
NOTE: Delta restores do not preserve exclusions. They remove files and directories that the backup excluded.
Do not use this option to exclude PostgreSQL logs. Use PostgreSQL log_directory to move logs outside PGDATA. This also preserves logs after a restore.
Specify multiple exclusions on the command line or in a configuration file.
Expire Auto Option (--expire-auto)
Automatically run the expire command after a successful backup.
This setting is enabled by default. Disable it with care: pgBackRest then keeps all backups and archives indefinitely, which can fill the repository. Run expire regularly to prevent this.
Automatic expiration after a successful backup uses the backup command configuration. Options set only in an expire command section, such as [global:expire], do not apply. To use those options, disable automatic expiration and run expire separately.
Force Option (--force)
Force an offline backup.
With --no-start-stop, pgBackRest runs a backup even if it detects that PostgreSQL is running. Use this option with extreme care. It will probably produce a bad backup.
A backup might still be useful in these conditions. For example, after a server crash, you might only be able to mount the cluster volume as read-only. A backup can then be useful even if postmaster.pid exists. Prefer to restore the previous backup and replay WAL. However, an unarchived WAL segment might contain a critical transaction.
Manifest Save Threshold Option (--manifest-save-threshold)
Manifest save threshold during backup.
Set how often pgBackRest saves the manifest during a backup. The manifest stores checksums so that backup resume can work efficiently. The actual threshold is 1% of backup size or manifest-save-threshold, whichever is greater.
Online Option (--online)
Perform an online backup.
Specify –no-online to prevent pgBackRest from calling the database cluster backup start/stop functions. Shut down PostgreSQL first. pgBackRest reports an error if PostgreSQL is running.
Use this option for offline backups. pgBackRest copies pg_xlog/pg_wal without changes and automatically disables archive-check for the backup.
Resume Option (--resume)
Allow resume of failed backup.
Enable or disable backup resume. After a backup fails, resume can substantially reduce the time for another backup of the same type. This feature adds complexity. You can disable it in environments that do not need it.
Start Fast Option (--start-fast)
Force a checkpoint to start backup quickly.
Pass y to the backup start function fast parameter to force a checkpoint and start the backup immediately. Otherwise, the backup waits for the next regular checkpoint.
Type Option (--type)
Backup type.
The following backup types are supported:
full- Copy all database cluster files without dependencies on earlier backups.incr- Create an incremental backup from the last successful backup.diff- Create an incremental backup based on the last full backup.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
pgBackRest Command Option (--cmd)
pgBackRest command.
pgBackRest can generate a command string, for example when restore generates the restore_command setting. It uses the command that started the pgBackRest process unless you specify the cmd option.
CAUTION:
Wrapping the pgBackRest command may cause unpredictable behavior and is not recommended.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Compress Option (--compress)
Use file compression.
Backup files are compatible with command-line compression tools.
This option is deprecated. Use compress-type instead.
Compress Level Option (--compress-level)
File compression level.
Set the file compression level when compress-type is not none or when compress=y (deprecated).
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Compress Type Option (--compress-type)
File compression type.
The following compression types are supported:
none- no compressionbz2- bzip2 compression formatgz- gzip compression formatlz4- lz4 compression format (not available on all platforms)zst- Zstandard compression format (not available on all platforms)
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
Database Timeout Option (--db-timeout)
Database query timeout.
Set the database query timeout in seconds. This includes backup start/stop functions, which can each take substantial time. Keep a high timeout unless these functions will return quickly. For example, you have set start-fast=y and know the cluster will generate few WAL segments during the backup.
NOTE: The
db-timeoutoption must be less than theprotocol-timeoutoption.
Delta Option (--delta)
Restore or backup using checksums.
By default, a restore expects existing but empty PostgreSQL data and tablespace directories. Enable this option for a delta restore that uses checksums.
During a backup, use checksums instead of timestamps to determine which files to copy.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Process Maximum Option (--process-max)
Max processes to use for compress/transfer.
Each process compresses and transfers data to increase command speed. Do not set process-max so high that database performance decreases.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Maintainer Options
Page Header Check Option (--page-header-check)
Check PostgreSQL page headers.
Enabled by default, this option adds page header checks.
Disable this option only when necessary, for example for encrypted pages.
Force PostgreSQL Version Option (--pg-version-force)
Force PostgreSQL version.
Use the specified PostgreSQL version instead of the version detected from pg_control or WAL headers. This is mainly useful for PostgreSQL forks or development versions whose values differ from the release version. The version that PostgreSQL reports through server_version_num must match the forced version.
WARNING:
Use this option with care. pgBackRest still reads pg_control and WAL headers in the official open-source PostgreSQL format for the specified version. Changes to fields that pgBackRest uses can cause unexpected behavior. Generally, the fork must add all custom struct members after the standard PostgreSQL members for this option to work correctly.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Block Incremental Backup Option (--repo-block)
Enable block incremental backup.
Block incremental backup divides files into blocks that can be backed up independently. This saves repository space. It can also improve delta restore performance because pgBackRest can fetch individual blocks without reading the entire repository file.
NOTE: The
repo-bundleoption must be enabled beforerepo-blockcan be enabled.
File size and age determine block size. Older or larger files generally use larger blocks. Files above the age threshold do not use block incremental backup.
For maximum efficiency, enable block incremental for all backup types, including full backups. Full backups become slightly larger. Later differential and incremental backups use their block maps to save space.
Repository Bundles Option (--repo-bundle)
Bundle files in repository.
Combine smaller files into bundles to reduce the number of repository files. Fewer file writes usually improve efficiency, especially with object stores such as S3. Zero-length files have only manifest entries and no stored file contents. This saves time and space.
Repository Bundle Limit Option (--repo-bundle-limit)
Limit for file bundles.
Set the maximum file size for inclusion in bundles. Larger files are stored separately.
A resumed backup cannot reuse bundled files. Higher limits put more files in bundles and leave fewer files available for resume.
Repository Bundle Size Option (--repo-bundle-size)
Target size for file bundles.
Set the target size of one file bundle. The uncompressed bundle can be as large as repo-bundle-size + repo-bundle-limit. Do not set this option to the maximum file size your filesystem permits.
Avoid very large bundles. A retry must repeat the entire bundle.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Hardlink Option (--repo-hardlink)
Hardlink files between backups in the repository.
Hard-link differential and incremental backup files to their full backups. Each backup then appears to be a full backup at the filesystem level. Use care: changes to hard-linked files can affect every backup in the set.
Deprecated Name: hardlink
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
Archive Retention Option (--repo-retention-archive)
Number of backups worth of continuous WAL to retain.
NOTE: 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 unset and repo-retention-full-type is count (the default), archive retention follows backup retention. When repo-retention-archive-type is full, it uses repo-retention-full. When the archive type is diff, it uses repo-retention-diff. Thus, WAL expires only for backups that have already expired. If repo-retention-full-type is time, the default removes archives older than the oldest full backup retained to satisfy repo-retention-full.
Set this option when repo-retention-archive-type is incr. With limited disk space, use it with repo-retention-archive-type to expire WAL segments more aggressively. However, backups with expired WAL cannot support PITR. This is not recommended.
Deprecated Name: retention-archive
Archive Retention Type Option (--repo-retention-archive-type)
Backup type for WAL retention.
When set to full, retain archive logs for the number of full backups specified by repo-retention-archive. When set to diff, count both full and differential backups. Thus, if the latest backup is full, it counts as a differential for repo-retention. When set to incr, count full, differential, and incremental backups. Prefer the default, which expires WAL only when full backups expire.
Deprecated Name: retention-archive-type
Differential Retention Option (--repo-retention-diff)
Number of differential backups to retain.
When a differential backup expires, its dependent incremental backups also expire. If this option is unset, differential backups remain until their parent full backups expire.
The differential backup count includes full backups. In most cases, this slightly reduces the number of differential backups retained.
Deprecated Name: retention-diff
Full Retention Option (--repo-retention-full)
Full backup retention count/time.
When a full backup expires, its dependent differential and incremental backups also expire. If this option is unset, pgBackRest reports a warning. For indefinite retention, use the maximum value.
Deprecated Name: retention-full
Full Retention Type Option (--repo-retention-full-type)
Retention type for full backups.
Select whether repo-retention-full specifies a number of days or a count of full backups to keep.
With time, pgBackRest removes full backups older than repo-retention-full only if another retained backup is at least that old. For example, set repo-retention-full to 30 days with two full backups aged 25 and 35 days. Neither expires. Removing the 35-day backup would leave only the 25-day backup, which cannot satisfy the 30-day policy. Archived WAL older than the oldest remaining full backup expires automatically unless you explicitly set repo-retention-archive-type and repo-retention-archive.
With count, pgBackRest expires full backups that exceed repo-retention-full. For example, with repo-retention-full set to 4, completion of a fifth full backup expires the oldest, leaving 4.
Only successfully completed backups count toward retention. For example, set repo-retention-full-type to count and repo-retention-full to 2. The oldest full backup expires only after 3 full backups complete.
Backup History Retention Option (--repo-retention-history)
Days of backup history manifests to retain.
When a backup completes, pgBackRest copies its manifest to backup.history. By default, these files never expire. They support analysis, such as measurements of backup and WAL growth over time.
Set repo-retention-history to the number of days of backup history manifests to retain. History always includes unexpired backups. Set repo-retention-history=0 to keep history only for unexpired backups.
When a full backup history manifest expires, its dependent differential and incremental backup history manifests also expire.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Repository Symlink Option (--repo-symlink)
Create symlinks within the repository.
Create latest and tablespace symlinks. These mainly help with snapshot-based, in-place repository recovery, which is uncommon.
Most users probably do not need this feature. It remains enabled by default for compatibility. Disable it for Posix-like storage that cannot support symlinks.
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
Stanza Options
PostgreSQL Database Option (--pg-database)
PostgreSQL database.
Set the database name for PostgreSQL connections. The default is usually suitable, but some installations do not have this database.
For compatibility, pgBackRest ignores the PGDATABASE environment variable.
PostgreSQL Host Option (--pg-host)
PostgreSQL host for operating remotely.
Use this option when the PostgreSQL host and repository host differ.
Deprecated Name: db-host
PostgreSQL Host Certificate Authority File Option (--pg-host-ca-file)
PostgreSQL host certificate authority file.
Use a CA file other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate Authority Path Option (--pg-host-ca-path)
PostgreSQL host certificate authority path.
Use a CA path other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate File Option (--pg-host-cert-file)
PostgreSQL host certificate file.
pgBackRest sends this certificate to the PostgreSQL host to prove the client identity.
PostgreSQL Host Command Option (--pg-host-cmd)
PostgreSQL host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and PostgreSQL hosts. Otherwise, the PostgreSQL host uses the local command path.
Deprecated Name: db-cmd
PostgreSQL Host Configuration Option (--pg-host-config)
pgBackRest database host configuration file.
Set the PostgreSQL host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: db-config
PostgreSQL Host Configuration Include Path Option (--pg-host-config-include-path)
pgBackRest database host configuration include path.
Set the PostgreSQL host configuration include path. This is necessary only when it differs from the local configuration include path.
PostgreSQL Host Configuration Path Option (--pg-host-config-path)
pgBackRest database host configuration path.
Set the PostgreSQL host configuration path. This is necessary only when it differs from the local configuration path.
PostgreSQL Host Key File Option (--pg-host-key-file)
PostgreSQL host key file.
This key proves that the certificate owner sent the client certificate.
PostgreSQL Host Port Option (--pg-host-port)
PostgreSQL host port when pg-host is set.
Use this option to specify a non-default port for the PostgreSQL host protocol.
NOTE: When
pg-host-type=ssh,pg-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: db-ssh-port
PostgreSQL Host Protocol Type Option (--pg-host-type)
PostgreSQL host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
PostgreSQL Host User Option (--pg-host-user)
PostgreSQL host logon user when pg-host is set.
This user owns the remote pgBackRest process and starts PostgreSQL connections. Use the PostgreSQL cluster owner, usually the default user postgres.
Deprecated Name: db-user
PostgreSQL Path Option (--pg-path)
PostgreSQL data directory.
Use the data_directory value reported by PostgreSQL. Other sources can provide this value, but they might be unavailable during a restore or offline backup. Set it here as a precaution.
Each online backup compares pg-path with the value reported by PostgreSQL. Thus, this setting should stay current.
Deprecated Name: db-path
PostgreSQL Port Option (--pg-port)
PostgreSQL port.
Set the PostgreSQL port. Most clusters use the default port, so this setting is usually unnecessary.
Deprecated Name: db-port
PostgreSQL Socket Path Option (--pg-socket-path)
PostgreSQL unix socket path.
Set the Unix socket directory selected at PostgreSQL startup. pgBackRest searches the standard location for your OS automatically. Usually, set this option only if unix_socket_directories in postgresql.conf specifies another directory.
Deprecated Name: db-socket-path
PostgreSQL Database User Option (--pg-user)
PostgreSQL database user.
Set the database user for PostgreSQL connections. If unset, pgBackRest uses the local OS user or PGUSER.
5 - Check Command (check)
check command options and behavior.Source: pgBackRest Command Docs: check
The check command validates pgBackRest and archive_command configuration for the specified stanza. It checks backup and archive settings for all repositories and databases configured on the current host. It detects configuration errors, especially archive errors that leave backups incomplete because required WAL segments never reached the archive. Run it on the PostgreSQL or repository host. You can also run it on a standby, but then it checks only repository configuration. A standby cannot execute pg_switch_xlog()/pg_switch_wal().
The command calls pg_create_restore_point('pgBackRest Archive Check') and pg_switch_xlog()/pg_switch_wal() to force PostgreSQL to archive a WAL segment.
Command Options
Check Archive Option (--archive-check)
Check that WAL segments are in the archive before backup completes.
Check that the WAL archive contains all segments necessary for backup consistency. Keep the default unless you use another archive method.
This option must be enabled if archive-copy is enabled.
Check Archive Mode Option (--archive-mode-check)
Check the PostgreSQL archive_mode setting.
Enabled by default, this option disallows PostgreSQL archive_mode=always.
A standby can push WAL segments with the same logical contents as primary segments but different checksums. Disable archiving from multiple sources to avoid these conflicts.
CAUTION:
If you disable this option, make sure that only one archiver writes to the repository through archive-push.
Archive Timeout Option (--archive-timeout)
Archive timeout.
Set the maximum wait, in seconds, for each WAL segment to reach the pgBackRest archive repository. The check and backup commands use this timeout while waiting for WAL segments necessary for backup consistency.
Backup from Standby Option (--backup-standby)
Backup from the standby cluster.
Enable backups from the standby to reduce primary cluster load. Configure both the primary and standby hosts to use this option.
The following modes are supported:
y- Standby is required for backup.prefer- Backup from standby if available otherwise backup from primary.n- Backup from primary only.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
Database Timeout Option (--db-timeout)
Database query timeout.
Set the database query timeout in seconds. This includes backup start/stop functions, which can each take substantial time. Keep a high timeout unless these functions will return quickly. For example, you have set start-fast=y and know the cluster will generate few WAL segments during the backup.
NOTE: The
db-timeoutoption must be less than theprotocol-timeoutoption.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Maintainer Options
Force PostgreSQL Version Option (--pg-version-force)
Force PostgreSQL version.
Use the specified PostgreSQL version instead of the version detected from pg_control or WAL headers. This is mainly useful for PostgreSQL forks or development versions whose values differ from the release version. The version that PostgreSQL reports through server_version_num must match the forced version.
WARNING:
Use this option with care. pgBackRest still reads pg_control and WAL headers in the official open-source PostgreSQL format for the specified version. Changes to fields that pgBackRest uses can cause unexpected behavior. Generally, the fork must add all custom struct members after the standard PostgreSQL members for this option to work correctly.
Repository Options
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
Stanza Options
PostgreSQL Database Option (--pg-database)
PostgreSQL database.
Set the database name for PostgreSQL connections. The default is usually suitable, but some installations do not have this database.
For compatibility, pgBackRest ignores the PGDATABASE environment variable.
PostgreSQL Host Option (--pg-host)
PostgreSQL host for operating remotely.
Use this option when the PostgreSQL host and repository host differ.
Deprecated Name: db-host
PostgreSQL Host Certificate Authority File Option (--pg-host-ca-file)
PostgreSQL host certificate authority file.
Use a CA file other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate Authority Path Option (--pg-host-ca-path)
PostgreSQL host certificate authority path.
Use a CA path other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate File Option (--pg-host-cert-file)
PostgreSQL host certificate file.
pgBackRest sends this certificate to the PostgreSQL host to prove the client identity.
PostgreSQL Host Command Option (--pg-host-cmd)
PostgreSQL host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and PostgreSQL hosts. Otherwise, the PostgreSQL host uses the local command path.
Deprecated Name: db-cmd
PostgreSQL Host Configuration Option (--pg-host-config)
pgBackRest database host configuration file.
Set the PostgreSQL host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: db-config
PostgreSQL Host Configuration Include Path Option (--pg-host-config-include-path)
pgBackRest database host configuration include path.
Set the PostgreSQL host configuration include path. This is necessary only when it differs from the local configuration include path.
PostgreSQL Host Configuration Path Option (--pg-host-config-path)
pgBackRest database host configuration path.
Set the PostgreSQL host configuration path. This is necessary only when it differs from the local configuration path.
PostgreSQL Host Key File Option (--pg-host-key-file)
PostgreSQL host key file.
This key proves that the certificate owner sent the client certificate.
PostgreSQL Host Port Option (--pg-host-port)
PostgreSQL host port when pg-host is set.
Use this option to specify a non-default port for the PostgreSQL host protocol.
NOTE: When
pg-host-type=ssh,pg-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: db-ssh-port
PostgreSQL Host Protocol Type Option (--pg-host-type)
PostgreSQL host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
PostgreSQL Host User Option (--pg-host-user)
PostgreSQL host logon user when pg-host is set.
This user owns the remote pgBackRest process and starts PostgreSQL connections. Use the PostgreSQL cluster owner, usually the default user postgres.
Deprecated Name: db-user
PostgreSQL Path Option (--pg-path)
PostgreSQL data directory.
Use the data_directory value reported by PostgreSQL. Other sources can provide this value, but they might be unavailable during a restore or offline backup. Set it here as a precaution.
Each online backup compares pg-path with the value reported by PostgreSQL. Thus, this setting should stay current.
Deprecated Name: db-path
PostgreSQL Port Option (--pg-port)
PostgreSQL port.
Set the PostgreSQL port. Most clusters use the default port, so this setting is usually unnecessary.
Deprecated Name: db-port
PostgreSQL Socket Path Option (--pg-socket-path)
PostgreSQL unix socket path.
Set the Unix socket directory selected at PostgreSQL startup. pgBackRest searches the standard location for your OS automatically. Usually, set this option only if unix_socket_directories in postgresql.conf specifies another directory.
Deprecated Name: db-socket-path
PostgreSQL Database User Option (--pg-user)
PostgreSQL database user.
Set the database user for PostgreSQL connections. If unset, pgBackRest uses the local OS user or PGUSER.
6 - Expire Command (expire)
expire command options and behavior.Source: pgBackRest Command Docs: expire
pgBackRest rotates full backups according to a count or time period. Count-based retention keeps a specified number of backups, regardless of their creation times. Differential retention uses a count, but a differential always expires with its parent full backup. Incremental backups have no independent expiration policy. They expire with their parent full or differential backup. See Full Backup Retention and Differential Backup Retention for details and examples.
By default, pgBackRest keeps archived WAL for unexpired backups. You can change this per repository with retention-archive options, but this is not recommended. See Archive Retention for details and examples.
The expire command runs automatically after each successful backup. You can also run it manually. A manual run applies each configured repository’s retention settings; --repo limits it to one repository. Use --set to expire a specific backup set. Without --repo, pgBackRest searches all repositories and expires sets that match. Every expire run also checks and applies archive retention.
Command Options
Expire Archive Before Option (--archive-expire-before)
Remove WAL archive earlier than the specified WAL segment.
Remove WAL segments before the specified segment only when retained backups do not need them. This includes segments older than the earliest retained backup, or any earlier segment if the repository has no backups. Keep the specified segment and all later segments. The value corresponds to PostgreSQL archive_cleanup_command %r.
This option mainly supports archive-only repositories without backups. It can also remove WAL older than the first backup before full retention requirements permit normal archive expiration.
Oldest Option (--oldest)
Expire the oldest eligible backup set.
Expire the oldest full backup set that leaves at least one newer full backup. This automatically calculates the equivalent of decreasing retention by one. All differential and incremental backups that depend on that full backup also expire.
This option temporarily adjusts archive retention so that the same run can remove WAL for the expired backups.
With time-based full retention (--repo-retention-full-type=time), --oldest uses count-based expiration for this run.
WARNING:
This option cannot be combined with --set.
Set Option (--set)
Backup set to expire.
Expire the specified backup label and all its dependent backups, regardless of retention rules. At least one full backup must remain in the repository.
WARNING:
Use this option with extreme care. It permanently removes the specified backup set and archived WAL not needed for backup consistency from the pgBackRest repository. This can prevent PITR. If --repo-retention-full or --repo-retention-archive is configured, override it with the maximum value during manual expiration. This helps prevent unintended archive expiration.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
Dry Run Option (--dry-run)
Execute a dry-run for the command.
Use the command-line-only --dry-run option to show the changes a command would make without applying them.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
Archive Retention Option (--repo-retention-archive)
Number of backups worth of continuous WAL to retain.
NOTE: 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 unset and repo-retention-full-type is count (the default), archive retention follows backup retention. When repo-retention-archive-type is full, it uses repo-retention-full. When the archive type is diff, it uses repo-retention-diff. Thus, WAL expires only for backups that have already expired. If repo-retention-full-type is time, the default removes archives older than the oldest full backup retained to satisfy repo-retention-full.
Set this option when repo-retention-archive-type is incr. With limited disk space, use it with repo-retention-archive-type to expire WAL segments more aggressively. However, backups with expired WAL cannot support PITR. This is not recommended.
Deprecated Name: retention-archive
Archive Retention Type Option (--repo-retention-archive-type)
Backup type for WAL retention.
When set to full, retain archive logs for the number of full backups specified by repo-retention-archive. When set to diff, count both full and differential backups. Thus, if the latest backup is full, it counts as a differential for repo-retention. When set to incr, count full, differential, and incremental backups. Prefer the default, which expires WAL only when full backups expire.
Deprecated Name: retention-archive-type
Differential Retention Option (--repo-retention-diff)
Number of differential backups to retain.
When a differential backup expires, its dependent incremental backups also expire. If this option is unset, differential backups remain until their parent full backups expire.
The differential backup count includes full backups. In most cases, this slightly reduces the number of differential backups retained.
Deprecated Name: retention-diff
Full Retention Option (--repo-retention-full)
Full backup retention count/time.
When a full backup expires, its dependent differential and incremental backups also expire. If this option is unset, pgBackRest reports a warning. For indefinite retention, use the maximum value.
Deprecated Name: retention-full
Full Retention Type Option (--repo-retention-full-type)
Retention type for full backups.
Select whether repo-retention-full specifies a number of days or a count of full backups to keep.
With time, pgBackRest removes full backups older than repo-retention-full only if another retained backup is at least that old. For example, set repo-retention-full to 30 days with two full backups aged 25 and 35 days. Neither expires. Removing the 35-day backup would leave only the 25-day backup, which cannot satisfy the 30-day policy. Archived WAL older than the oldest remaining full backup expires automatically unless you explicitly set repo-retention-archive-type and repo-retention-archive.
With count, pgBackRest expires full backups that exceed repo-retention-full. For example, with repo-retention-full set to 4, completion of a fifth full backup expires the oldest, leaving 4.
Only successfully completed backups count toward retention. For example, set repo-retention-full-type to count and repo-retention-full to 2. The oldest full backup expires only after 3 full backups complete.
Backup History Retention Option (--repo-retention-history)
Days of backup history manifests to retain.
When a backup completes, pgBackRest copies its manifest to backup.history. By default, these files never expire. They support analysis, such as measurements of backup and WAL growth over time.
Set repo-retention-history to the number of days of backup history manifests to retain. History always includes unexpired backups. Set repo-retention-history=0 to keep history only for unexpired backups.
When a full backup history manifest expires, its dependent differential and incremental backup history manifests also expire.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Repository Symlink Option (--repo-symlink)
Create symlinks within the repository.
Create latest and tablespace symlinks. These mainly help with snapshot-based, in-place repository recovery, which is uncommon.
Most users probably do not need this feature. It remains enabled by default for compatibility. Disable it for Posix-like storage that cannot support symlinks.
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
7 - Help Command (help)
help command options and behavior.Source: pgBackRest Command Docs: help
Help has three levels. With no command, pgBackRest shows general help. With a command, such as pgbackrest help backup, it shows the command description and valid options. Add an option, such as pgbackrest help backup type, to show its full description for that command.
Command Options
Display Help Option (--help)
Display help.
Show help even without the help command. This overrides --version.
Display Version Option (--version)
Display version.
Show the version even without the version or help command.
8 - Info Command (info)
info command options and behavior.Source: pgBackRest Command Docs: info
The info command reports on one stanza or all stanzas. By default, text output summarizes backups for the requested stanzas. The text format can change in any release.
For machine-readable output, use --output=json. JSON includes much more information than text output. Its format stays stable unless a bug requires a change.
Use --detail-level=progress to show only progress and reduce execution time. This skips all checks except stanza availability.
Each stanza has a separate section. Use --stanza to show only one. The status field indicates stanza health: ok means pgBackRest operates normally. With multiple repositories, mixed means at least one repository has an unhealthy stanza; output then gives the status per repository. An unknown repository error uses the code other and includes full error details.
The wal archive min/max field shows the minimum and maximum archived WAL. With multiple repositories, it covers all repositories unless you set --repo. Archive retention policies or other causes can leave gaps in this range.
The backup/expire running and/or restore running messages appear beside status when those commands run on the host. Text output also shows progress per repository. JSON output includes a repo array.
Backups appear from oldest to newest. The oldest is always a full backup, with an F at the end of its label. The newest can be full, differential (label ends with D), or incremental (label ends with I).
The timestamp start/stop field shows when the backup ran. Use timestamp stop to choose a backup for Point-In-Time Recovery. See Point-In-Time Recovery for details.
The wal start/stop field shows the WAL range necessary for database consistency after a restore. The backup command checks that the archive contains this range before it completes.
The database size field shows the full, uncompressed database size. The database backup size field shows the database data actually backed up. These values match for full backups.
The repo field identifies the repository that contains the backup. The backup set size includes files in this backup and referenced backups needed for a restore. The backup size includes only files in this backup. These sizes match for full backups. When pgBackRest compression is enabled, repository sizes reflect compressed files.
The backup reference total summarizes other backups needed to restore this backup. Use --set for the complete reference list.
Command Options
Detail level Option (--detail-level)
Output detail level.
The following levels are supported:
progress- Output only the current backup/expire progress. This level cannot be used with the--setoption.full- Output full info.
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.
Set Option (--set)
Backup set to detail.
Details include all additional backups needed for a restore. They also list databases and OIDs, except template databases. Tablespace details include OIDs and default restore destinations. Symlink details show restore destinations when --link-all is specified.
Type Option (--type)
Filter on backup type.
Filter the output using one of the following backup types:
full- Output only full backups.diff- Output only differential backups.incr- Output only incremental backups.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Target Time for Repository Option (--repo-target-time)
Target time for repository.
Set the point in time at which commands read a repository on versioned storage. This lets you recover data deleted or corrupted by user error or malware.
S3, GCS, and Azure support versioned storage, but usually disable it by default. In addition to versioning, consider S3 object locking or GCS and Azure soft delete.
When you specify repo-target-time, you must also specify repo. Some repository types probably will not support versioning. Recovery usually targets one repository.
Storage timestamps must be <= the specified timestamp. pgBackRest truncates milliseconds from the specified timestamp.
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
9 - Repository Get Command (repo-get)
repo-get command options and behavior.This command works like Unix cat on any supported repository type. Supply a fully qualified file name. It mainly supports administration, investigation, and testing. A normal pgBackRest setup does not require it.
For an encrypted repository, repo-get decrypts the file automatically. It does not decompress files. Pipe the output through the appropriate decompression command, such as gzip -d.
With multiple repositories, this command uses the highest priority repository, such as repo1. Use --repo to select another repository.
Command Options
Ignore Missing Option (--ignore-missing)
Ignore missing source file.
If the source file is missing, exit with status 1 without reporting an error.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Raw Data Option (--raw)
Do not transform data.
Do not transform data, such as through encryption or decompression, for this command.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Target Time for Repository Option (--repo-target-time)
Target time for repository.
Set the point in time at which commands read a repository on versioned storage. This lets you recover data deleted or corrupted by user error or malware.
S3, GCS, and Azure support versioned storage, but usually disable it by default. In addition to versioning, consider S3 object locking or GCS and Azure soft delete.
When you specify repo-target-time, you must also specify repo. Some repository types probably will not support versioning. Recovery usually targets one repository.
Storage timestamps must be <= the specified timestamp. pgBackRest truncates milliseconds from the specified timestamp.
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
10 - Repository List Command (repo-ls)
repo-ls command options and behavior.Source: pgBackRest Command Docs: repo-ls
This command works like Unix ls on any supported repository type. Supply an absolute path or a path relative to --repo-path. It mainly supports administration, investigation, and testing. A normal pgBackRest setup does not require it.
Default text output prints one file name per line. Use --output=json for JSON output.
With multiple repositories, this command uses the highest priority repository, such as repo1. Use --repo to select another repository.
Command Options
Filter Output Option (--filter)
Filter output with a regular expression.
Apply the filter to file and path names before output.
Output Option (--output)
Output format.
The following output types are supported:
text- Simple list with one file/link/path name on each line.json- Detailed file/link/path information in JSON format.
In JSON format the available fields are:
name- file/link/path name (and partial path when recursing).type-file,path, orlink.size- size in bytes (files only).time- time last modified (files only).destination- link destination (links only).
Recurse Subpaths Option (--recurse)
Include all subpaths in output.
Include every subpath and its files in the output.
Sort Output Option (--sort)
Sort output ascending, descending, or none.
The following sort types are supported:
asc- sort ascending.desc- sort descending.none- no sorting.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Target Time for Repository Option (--repo-target-time)
Target time for repository.
Set the point in time at which commands read a repository on versioned storage. This lets you recover data deleted or corrupted by user error or malware.
S3, GCS, and Azure support versioned storage, but usually disable it by default. In addition to versioning, consider S3 object locking or GCS and Azure soft delete.
When you specify repo-target-time, you must also specify repo. Some repository types probably will not support versioning. Recovery usually targets one repository.
Storage timestamps must be <= the specified timestamp. pgBackRest truncates milliseconds from the specified timestamp.
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
11 - Restore Command (restore)
restore command options and behavior.Source: pgBackRest Command Docs: restore
By default, restore selects the latest backup from the first repository that has backups. See Quick Start - Restore a Backup. The repository order comes from pgbackrest.conf; for example, repo1 precedes repo2. Use --repo, such as --repo=1, to select a repository. Use --set to select a backup other than the latest.
For PITR with --type=time or --type=lsn, specify the target time or LSN with --target. Without --set, pgBackRest searches configured repositories in order for a backup containing the requested time or LSN. If none matches, --type=time uses the latest backup in the first repository that has backups. For --type=lsn, it selects no backup. For other PITR types, such as xid, use --set if the target precedes the latest backup. See Point-in-Time Recovery for details and examples.
Backups exclude replication slots, as PostgreSQL recommends. See Backing Up The Data Directory.
Command Options
Archive Mode Option (--archive-mode)
Preserve or disable archiving on restored cluster.
Preserve or disable archiving on the restored cluster. Disable it when you must promote the cluster for work but it will not become the new primary. In that case, the cluster should not push WAL to the repository.
The following modes are supported:
off- disable archiving by settingarchive_mode=off.preserve- preserve currentarchive_modesetting.
NOTE: This option is not available on PostgreSQL < 12.
Exclude Database Option (--db-exclude)
Restore excluding the specified databases.
Restore excluded databases as sparse, zeroed files. This saves space while allowing PostgreSQL recovery. After recovery, you cannot access these databases, but you can remove them with drop database. Repeat --db-exclude to exclude multiple databases.
When combined with --db-include, --db-exclude applies only to the standard system databases: template0, template1, and postgres.
Include Database Option (--db-include)
Restore only specified databases.
Restore only selected databases. Restore other databases as sparse, zeroed files to save space while allowing PostgreSQL recovery. After recovery, you cannot access the other databases, but you can remove them with drop database.
NOTE: built-in databases (
template0,template1, andpostgres) are always restored unless specifically excluded.
Repeat --db-include to include multiple databases.
See Restore Selected Databases for additional information and caveats.
Force Option (--force)
Force a restore.
Used alone, this option completely overwrites PostgreSQL data and tablespace paths. With --delta, it uses timestamps and sizes instead of checksums for the delta restore.
Link All Option (--link-all)
Restore all symlinks.
By default, restore converts symlinks to regular files and directories in $PGDATA. Original symlink destinations might be unsafe on a different system. Enable this option to restore all symlinks as they were on the backup source system.
Link Map Option (--link-map)
Modify the destination of a symlink.
Change a symlink destination file or path during a restore. Use this when the destination system has a different storage layout from the backup source.
Recovery Option (--recovery-option)
Set an option in postgresql.auto.conf or recovery.conf.
See Server Configuration for postgresql.auto.conf and recovery.conf options. Select your PostgreSQL version. You can repeat this option.
For PostgreSQL >= 12, pgBackRest writes options to postgresql.auto.conf. For earlier versions, it writes them to recovery.conf.
NOTE: pgBackRest generates
restore_commandautomatically. This option can override it, but use care because pgBackRest manages it for you. pgBackRest also generates target recovery options, such as recovery_target_name and recovery_target_time. Do not set those options here.
pgBackRest does not start PostgreSQL after it writes postgresql.auto.conf or recovery.conf. You can check or edit the file before you restart PostgreSQL manually.
Set Option (--set)
Backup set to restore.
Set the backup to restore. Use latest for the latest backup, or specify a backup name.
Tablespace Map Option (--tablespace-map)
Restore a tablespace into the specified directory.
Move a tablespace during restore. Use this when a replica has different tablespace locations or an upgraded system has different mount points.
pg_tablespace does not store tablespace locations, so you can move tablespaces freely. However, do not move a tablespace to data_directory; this can cause problems. For more information, see http://www.databasesoup.com/2013/11/moving-tablespaces.html.
Map All Tablespaces Option (--tablespace-map-all)
Restore all tablespaces into the specified directory.
By default, tablespaces return to their original locations. Use tablespace-map to change individual locations, or this option to move all tablespaces to one new directory. This helps with development or staging systems whose storage layout differs from the backup source.
Use the specified path as the parent directory for all restored tablespaces.
CAUTION:
pgBackRest cannot map tablespaces created after the backup starts. If you need mapping, take a new backup after creating a tablespace.
Target Option (--target)
Recovery target.
Set the recovery target for --type values lsn, name, xid, or time. If the target precedes the latest backup, use --set unless the type is time or lsn.
Target Action Option (--target-action)
Action to take when recovery target is reached.
With hot_standby=on, this option controls the cluster action at the target or the end of archived WAL. PostgreSQL 10 and later enable hot standby by default.
When hot_standby=off in PostgreSQL >= 12, pause acts like shutdown. When hot_standby=off in PostgreSQL < 12, pause acts like promote.
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. (PostgreSQL >= 9.5)
Target Exclusive Option (--target-exclusive)
Stop just before the recovery target is reached.
Stop before the target instead of including it, which is the default. This applies only when --type is lsn, time, or xid. For example, --target-exclusive excludes transaction 1007 when --type=xid and --target=1007. See PostgreSQL recovery_target_inclusive documentation for details.
Target Timeline Option (--target-timeline)
Recover along a timeline.
See recovery_target_timeline in the PostgreSQL docs for more information.
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 is consistent.lsn- Recover to the LSN (Log Sequence Number) in--target. Requires PostgreSQL >= 10.name- Recover to the restore point in--target.xid- Recover to the transaction ID in--target.time- Recover to the time in--target.preserve- Preserve the existingpostgresql.auto.conforrecovery.conffile.standby- Addstandby_mode=ontopostgresql.auto.conforrecovery.confto start the cluster in standby mode.none- Do not writepostgresql.auto.conforrecovery.conf. PostgreSQL attempts to reach consistency with WAL segments inpg_xlog/pg_wal. Supply the required segments or include them in the backup witharchive-copy.
WARNING:
Avoid recovery with type=none. It does not increment the timeline after recovery. PostgreSQL might then try to archive duplicate WAL, which the archive rejects. This can fill the disk and cause a PostgreSQL panic. Tools such as pg_rewind might also fail or corrupt data.
Offline backups default to restore type of none because wal_level=minimal prevents Point-in-Time Recovery. pgBackRest respects an explicit type setting. Offline backups support Point-in-Time Recovery when wal_level > minimal.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
pgBackRest Command Option (--cmd)
pgBackRest command.
pgBackRest can generate a command string, for example when restore generates the restore_command setting. It uses the command that started the pgBackRest process unless you specify the cmd option.
CAUTION:
Wrapping the pgBackRest command may cause unpredictable behavior and is not recommended.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
Delta Option (--delta)
Restore or backup using checksums.
By default, a restore expects existing but empty PostgreSQL data and tablespace directories. Enable this option for a delta restore that uses checksums.
During a backup, use checksums instead of timestamps to determine which files to copy.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Process Maximum Option (--process-max)
Max processes to use for compress/transfer.
Each process compresses and transfers data to increase command speed. Do not set process-max so high that database performance decreases.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Maintainer Options
Force PostgreSQL Version Option (--pg-version-force)
Force PostgreSQL version.
Use the specified PostgreSQL version instead of the version detected from pg_control or WAL headers. This is mainly useful for PostgreSQL forks or development versions whose values differ from the release version. The version that PostgreSQL reports through server_version_num must match the forced version.
WARNING:
Use this option with care. pgBackRest still reads pg_control and WAL headers in the official open-source PostgreSQL format for the specified version. Changes to fields that pgBackRest uses can cause unexpected behavior. Generally, the fork must add all custom struct members after the standard PostgreSQL members for this option to work correctly.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Target Time for Repository Option (--repo-target-time)
Target time for repository.
Set the point in time at which commands read a repository on versioned storage. This lets you recover data deleted or corrupted by user error or malware.
S3, GCS, and Azure support versioned storage, but usually disable it by default. In addition to versioning, consider S3 object locking or GCS and Azure soft delete.
When you specify repo-target-time, you must also specify repo. Some repository types probably will not support versioning. Recovery usually targets one repository.
Storage timestamps must be <= the specified timestamp. pgBackRest truncates milliseconds from the specified timestamp.
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
Stanza Options
PostgreSQL Path Option (--pg-path)
PostgreSQL data directory.
Use the data_directory value reported by PostgreSQL. Other sources can provide this value, but they might be unavailable during a restore or offline backup. Set it here as a precaution.
Each online backup compares pg-path with the value reported by PostgreSQL. Thus, this setting should stay current.
Deprecated Name: db-path
12 - Server Command (server)
server command options and behavior.Source: pgBackRest Command Docs: server
The pgBackRest server allows access to remote hosts without using the SSH protocol.
Command Options
TLS Server Address Option (--tls-server-address)
TLS server address.
Set the IP address on which the server accepts client requests.
TLS Server Authorized Clients Option (--tls-server-auth)
TLS server authorized clients.
The server verifies each client certificate. It also checks the certificate CN (Common Name) against the list configured with tls-server-auth.
To authorize a client CN for multiple stanzas, provide a comma-separated list to tls-server-auth. To authorize all stanzas, use tls-server-auth=client-cn=*. The client CN cannot contain wildcards.
TLS Server Certificate Authorities Option (--tls-server-ca-file)
TLS server certificate authorities.
Checks that client certificates are signed by a trusted certificate authority.
TLS Server Certificate Option (--tls-server-cert-file)
TLS server certificate file.
The server sends this certificate to identify itself to the client.
TLS Server Key Option (--tls-server-key-file)
TLS server key file.
This key proves that the certificate owner sent the server certificate.
TLS Server Port Option (--tls-server-port)
TLS server port.
Set the port on which the server accepts client requests.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
13 - Server Ping Command (server-ping)
server-ping command options and behavior.Ping a pgBackRest TLS server to check whether it accepts connections. This checks availability only; it does not attempt authentication.
If the command line does not specify a host, use tls-server-host.
Command Options
TLS Server Address Option (--tls-server-address)
TLS server address.
Set the IP address on which the server accepts client requests.
TLS Server Port Option (--tls-server-port)
TLS server port.
Set the port on which the server accepts client requests.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
14 - Stanza Create Command (stanza-create)
stanza-create command options and behavior.After configuring a stanza in pgbackrest.conf, run stanza-create. With multiple repositories, pgBackRest creates the stanza in each one. It skips existing stanzas, so you can safely repeat stanza-create, including after adding a repository.
See Create the Stanza for more information and an example.
Command Options
Online Option (--online)
Create on an online cluster.
Specify –no-online to create the stanza without connecting to PostgreSQL.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
Database Timeout Option (--db-timeout)
Database query timeout.
Set the database query timeout in seconds. This includes backup start/stop functions, which can each take substantial time. Keep a high timeout unless these functions will return quickly. For example, you have set start-fast=y and know the cluster will generate few WAL segments during the backup.
NOTE: The
db-timeoutoption must be less than theprotocol-timeoutoption.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Maintainer Options
Force PostgreSQL Version Option (--pg-version-force)
Force PostgreSQL version.
Use the specified PostgreSQL version instead of the version detected from pg_control or WAL headers. This is mainly useful for PostgreSQL forks or development versions whose values differ from the release version. The version that PostgreSQL reports through server_version_num must match the forced version.
WARNING:
Use this option with care. pgBackRest still reads pg_control and WAL headers in the official open-source PostgreSQL format for the specified version. Changes to fields that pgBackRest uses can cause unexpected behavior. Generally, the fork must add all custom struct members after the standard PostgreSQL members for this option to work correctly.
Repository Options
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
Stanza Options
PostgreSQL Database Option (--pg-database)
PostgreSQL database.
Set the database name for PostgreSQL connections. The default is usually suitable, but some installations do not have this database.
For compatibility, pgBackRest ignores the PGDATABASE environment variable.
PostgreSQL Host Option (--pg-host)
PostgreSQL host for operating remotely.
Use this option when the PostgreSQL host and repository host differ.
Deprecated Name: db-host
PostgreSQL Host Certificate Authority File Option (--pg-host-ca-file)
PostgreSQL host certificate authority file.
Use a CA file other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate Authority Path Option (--pg-host-ca-path)
PostgreSQL host certificate authority path.
Use a CA path other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate File Option (--pg-host-cert-file)
PostgreSQL host certificate file.
pgBackRest sends this certificate to the PostgreSQL host to prove the client identity.
PostgreSQL Host Command Option (--pg-host-cmd)
PostgreSQL host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and PostgreSQL hosts. Otherwise, the PostgreSQL host uses the local command path.
Deprecated Name: db-cmd
PostgreSQL Host Configuration Option (--pg-host-config)
pgBackRest database host configuration file.
Set the PostgreSQL host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: db-config
PostgreSQL Host Configuration Include Path Option (--pg-host-config-include-path)
pgBackRest database host configuration include path.
Set the PostgreSQL host configuration include path. This is necessary only when it differs from the local configuration include path.
PostgreSQL Host Configuration Path Option (--pg-host-config-path)
pgBackRest database host configuration path.
Set the PostgreSQL host configuration path. This is necessary only when it differs from the local configuration path.
PostgreSQL Host Key File Option (--pg-host-key-file)
PostgreSQL host key file.
This key proves that the certificate owner sent the client certificate.
PostgreSQL Host Port Option (--pg-host-port)
PostgreSQL host port when pg-host is set.
Use this option to specify a non-default port for the PostgreSQL host protocol.
NOTE: When
pg-host-type=ssh,pg-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: db-ssh-port
PostgreSQL Host Protocol Type Option (--pg-host-type)
PostgreSQL host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
PostgreSQL Host User Option (--pg-host-user)
PostgreSQL host logon user when pg-host is set.
This user owns the remote pgBackRest process and starts PostgreSQL connections. Use the PostgreSQL cluster owner, usually the default user postgres.
Deprecated Name: db-user
PostgreSQL Path Option (--pg-path)
PostgreSQL data directory.
Use the data_directory value reported by PostgreSQL. Other sources can provide this value, but they might be unavailable during a restore or offline backup. Set it here as a precaution.
Each online backup compares pg-path with the value reported by PostgreSQL. Thus, this setting should stay current.
Deprecated Name: db-path
PostgreSQL Port Option (--pg-port)
PostgreSQL port.
Set the PostgreSQL port. Most clusters use the default port, so this setting is usually unnecessary.
Deprecated Name: db-port
PostgreSQL Socket Path Option (--pg-socket-path)
PostgreSQL unix socket path.
Set the Unix socket directory selected at PostgreSQL startup. pgBackRest searches the standard location for your OS automatically. Usually, set this option only if unix_socket_directories in postgresql.conf specifies another directory.
Deprecated Name: db-socket-path
PostgreSQL Database User Option (--pg-user)
PostgreSQL database user.
Set the database user for PostgreSQL connections. If unset, pgBackRest uses the local OS user or PGUSER.
15 - Stanza Delete Command (stanza-delete)
stanza-delete command options and behavior.The stanza-delete command removes repository data for a stanza.
WARNING:
Use this command with care. It permanently removes every backup and archive for the specified stanza from the pgBackRest repository.
To delete a stanza:
- Shut down the PostgreSQL cluster associated with the stanza (or use –force to override).
- Run the
stopcommand on the host where thestanza-deletecommand will be run. - Run the
stanza-deletecommand.
After the command succeeds, remove the stanza from all applicable pgBackRest configuration files and environment variables.
Delete a stanza from one repository at a time. For multiple repositories, repeat stanza-delete with --repo for each repository.
Command Options
Force Option (--force)
Force stanza delete.
Use this option to delete the repository stanza even when its PostgreSQL cluster is running.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
Database Timeout Option (--db-timeout)
Database query timeout.
Set the database query timeout in seconds. This includes backup start/stop functions, which can each take substantial time. Keep a high timeout unless these functions will return quickly. For example, you have set start-fast=y and know the cluster will generate few WAL segments during the backup.
NOTE: The
db-timeoutoption must be less than theprotocol-timeoutoption.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Maintainer Options
Force PostgreSQL Version Option (--pg-version-force)
Force PostgreSQL version.
Use the specified PostgreSQL version instead of the version detected from pg_control or WAL headers. This is mainly useful for PostgreSQL forks or development versions whose values differ from the release version. The version that PostgreSQL reports through server_version_num must match the forced version.
WARNING:
Use this option with care. pgBackRest still reads pg_control and WAL headers in the official open-source PostgreSQL format for the specified version. Changes to fields that pgBackRest uses can cause unexpected behavior. Generally, the fork must add all custom struct members after the standard PostgreSQL members for this option to work correctly.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
Stanza Options
PostgreSQL Database Option (--pg-database)
PostgreSQL database.
Set the database name for PostgreSQL connections. The default is usually suitable, but some installations do not have this database.
For compatibility, pgBackRest ignores the PGDATABASE environment variable.
PostgreSQL Host Option (--pg-host)
PostgreSQL host for operating remotely.
Use this option when the PostgreSQL host and repository host differ.
Deprecated Name: db-host
PostgreSQL Host Certificate Authority File Option (--pg-host-ca-file)
PostgreSQL host certificate authority file.
Use a CA file other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate Authority Path Option (--pg-host-ca-path)
PostgreSQL host certificate authority path.
Use a CA path other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate File Option (--pg-host-cert-file)
PostgreSQL host certificate file.
pgBackRest sends this certificate to the PostgreSQL host to prove the client identity.
PostgreSQL Host Command Option (--pg-host-cmd)
PostgreSQL host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and PostgreSQL hosts. Otherwise, the PostgreSQL host uses the local command path.
Deprecated Name: db-cmd
PostgreSQL Host Configuration Option (--pg-host-config)
pgBackRest database host configuration file.
Set the PostgreSQL host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: db-config
PostgreSQL Host Configuration Include Path Option (--pg-host-config-include-path)
pgBackRest database host configuration include path.
Set the PostgreSQL host configuration include path. This is necessary only when it differs from the local configuration include path.
PostgreSQL Host Configuration Path Option (--pg-host-config-path)
pgBackRest database host configuration path.
Set the PostgreSQL host configuration path. This is necessary only when it differs from the local configuration path.
PostgreSQL Host Key File Option (--pg-host-key-file)
PostgreSQL host key file.
This key proves that the certificate owner sent the client certificate.
PostgreSQL Host Port Option (--pg-host-port)
PostgreSQL host port when pg-host is set.
Use this option to specify a non-default port for the PostgreSQL host protocol.
NOTE: When
pg-host-type=ssh,pg-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: db-ssh-port
PostgreSQL Host Protocol Type Option (--pg-host-type)
PostgreSQL host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
PostgreSQL Host User Option (--pg-host-user)
PostgreSQL host logon user when pg-host is set.
This user owns the remote pgBackRest process and starts PostgreSQL connections. Use the PostgreSQL cluster owner, usually the default user postgres.
Deprecated Name: db-user
PostgreSQL Path Option (--pg-path)
PostgreSQL data directory.
Use the data_directory value reported by PostgreSQL. Other sources can provide this value, but they might be unavailable during a restore or offline backup. Set it here as a precaution.
Each online backup compares pg-path with the value reported by PostgreSQL. Thus, this setting should stay current.
Deprecated Name: db-path
PostgreSQL Port Option (--pg-port)
PostgreSQL port.
Set the PostgreSQL port. Most clusters use the default port, so this setting is usually unnecessary.
Deprecated Name: db-port
PostgreSQL Socket Path Option (--pg-socket-path)
PostgreSQL unix socket path.
Set the Unix socket directory selected at PostgreSQL startup. pgBackRest searches the standard location for your OS automatically. Usually, set this option only if unix_socket_directories in postgresql.conf specifies another directory.
Deprecated Name: db-socket-path
PostgreSQL Database User Option (--pg-user)
PostgreSQL database user.
Set the database user for PostgreSQL connections. If unset, pgBackRest uses the local OS user or PGUSER.
16 - Stanza Upgrade Command (stanza-upgrade)
stanza-upgrade command options and behavior.Immediately after a PostgreSQL major version upgrade, update pg-path in all pgBackRest configurations to the new database location. Then run stanza-upgrade. It upgrades the stanza in every repository configured on the host. If the database is offline, use --no-online.
Command Options
Online Option (--online)
Update an online cluster.
Specify –no-online to upgrade the stanza without connecting to PostgreSQL.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
Database Timeout Option (--db-timeout)
Database query timeout.
Set the database query timeout in seconds. This includes backup start/stop functions, which can each take substantial time. Keep a high timeout unless these functions will return quickly. For example, you have set start-fast=y and know the cluster will generate few WAL segments during the backup.
NOTE: The
db-timeoutoption must be less than theprotocol-timeoutoption.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Maintainer Options
Force PostgreSQL Version Option (--pg-version-force)
Force PostgreSQL version.
Use the specified PostgreSQL version instead of the version detected from pg_control or WAL headers. This is mainly useful for PostgreSQL forks or development versions whose values differ from the release version. The version that PostgreSQL reports through server_version_num must match the forced version.
WARNING:
Use this option with care. pgBackRest still reads pg_control and WAL headers in the official open-source PostgreSQL format for the specified version. Changes to fields that pgBackRest uses can cause unexpected behavior. Generally, the fork must add all custom struct members after the standard PostgreSQL members for this option to work correctly.
Repository Options
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
Stanza Options
PostgreSQL Database Option (--pg-database)
PostgreSQL database.
Set the database name for PostgreSQL connections. The default is usually suitable, but some installations do not have this database.
For compatibility, pgBackRest ignores the PGDATABASE environment variable.
PostgreSQL Host Option (--pg-host)
PostgreSQL host for operating remotely.
Use this option when the PostgreSQL host and repository host differ.
Deprecated Name: db-host
PostgreSQL Host Certificate Authority File Option (--pg-host-ca-file)
PostgreSQL host certificate authority file.
Use a CA file other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate Authority Path Option (--pg-host-ca-path)
PostgreSQL host certificate authority path.
Use a CA path other than the system default for connecting to the PostgreSQL host.
PostgreSQL Host Certificate File Option (--pg-host-cert-file)
PostgreSQL host certificate file.
pgBackRest sends this certificate to the PostgreSQL host to prove the client identity.
PostgreSQL Host Command Option (--pg-host-cmd)
PostgreSQL host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and PostgreSQL hosts. Otherwise, the PostgreSQL host uses the local command path.
Deprecated Name: db-cmd
PostgreSQL Host Configuration Option (--pg-host-config)
pgBackRest database host configuration file.
Set the PostgreSQL host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: db-config
PostgreSQL Host Configuration Include Path Option (--pg-host-config-include-path)
pgBackRest database host configuration include path.
Set the PostgreSQL host configuration include path. This is necessary only when it differs from the local configuration include path.
PostgreSQL Host Configuration Path Option (--pg-host-config-path)
pgBackRest database host configuration path.
Set the PostgreSQL host configuration path. This is necessary only when it differs from the local configuration path.
PostgreSQL Host Key File Option (--pg-host-key-file)
PostgreSQL host key file.
This key proves that the certificate owner sent the client certificate.
PostgreSQL Host Port Option (--pg-host-port)
PostgreSQL host port when pg-host is set.
Use this option to specify a non-default port for the PostgreSQL host protocol.
NOTE: When
pg-host-type=ssh,pg-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: db-ssh-port
PostgreSQL Host Protocol Type Option (--pg-host-type)
PostgreSQL host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
PostgreSQL Host User Option (--pg-host-user)
PostgreSQL host logon user when pg-host is set.
This user owns the remote pgBackRest process and starts PostgreSQL connections. Use the PostgreSQL cluster owner, usually the default user postgres.
Deprecated Name: db-user
PostgreSQL Path Option (--pg-path)
PostgreSQL data directory.
Use the data_directory value reported by PostgreSQL. Other sources can provide this value, but they might be unavailable during a restore or offline backup. Set it here as a precaution.
Each online backup compares pg-path with the value reported by PostgreSQL. Thus, this setting should stay current.
Deprecated Name: db-path
PostgreSQL Port Option (--pg-port)
PostgreSQL port.
Set the PostgreSQL port. Most clusters use the default port, so this setting is usually unnecessary.
Deprecated Name: db-port
PostgreSQL Socket Path Option (--pg-socket-path)
PostgreSQL unix socket path.
Set the Unix socket directory selected at PostgreSQL startup. pgBackRest searches the standard location for your OS automatically. Usually, set this option only if unix_socket_directories in postgresql.conf specifies another directory.
Deprecated Name: db-socket-path
PostgreSQL Database User Option (--pg-user)
PostgreSQL database user.
Set the database user for PostgreSQL connections. If unset, pgBackRest uses the local OS user or PGUSER.
17 - Start Command (start)
start command options and behavior.Source: pgBackRest Command Docs: start
After stop prevents pgBackRest processes from running, use start to permit them again. This does not immediately start any processes. See Starting and Stopping for details and examples.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
18 - Stop Command (stop)
stop command options and behavior.Source: pgBackRest Command Docs: stop
Prevent new pgBackRest processes from running. By default, existing processes can finish. Use --force to terminate them.
After stop completes, new pgBackRest processes return an error. See Starting and Stopping for details and examples.
Command Options
Force Option (--force)
Force all pgBackRest processes to stop.
Send TERM signals to all running pgBackRest processes for an immediate, graceful shutdown. This also stops processes started elsewhere that have remote processes on this host. For example, stop --force on the database server stops a backup that started on the backup server.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
Lock Path Option (--lock-path)
Path where lock files are stored.
pgBackRest creates lock files in this path to prevent conflicting operations from running at the same time.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
19 - Verify Command (verify)
verify command options and behavior.Source: pgBackRest Command Docs: verify
Verify checks whether repository backups and archives are valid.
Command Options
Output Option (--output)
Output type.
The following output types are supported:
none- No verify output.text- Output verify information to stdout.
Set Option (--set)
Backup set to verify.
Verify all database and archive files associated with the specified backup set.
Verbose Option (--verbose)
Verbose output.
The default, false, reports only essential repository error information. Set true for more details about successful verification.
General Options
Allow Run as Root Option (--allow-root)
Allow the command to run as the root user.
By default, only restore can run as root because it manages file ownership. Other commands can create root-owned files, for example in the repository. The PostgreSQL user cannot access these files, which causes later commands to fail.
Enable this option to run another command as root. Preferably, run pgBackRest as the user that owns the repository and PostgreSQL cluster.
Buffer Size Option (--buffer-size)
Buffer size for I/O operations.
Set the buffer size for copy, compression, encryption, and other operations. Options determine the number of buffers. Each operation can also use more memory. For example, gz compression can use an additional 256KiB.
Allowed values are 16KiB, 32KiB, 64KiB, 128KiB, 256KiB, 512KiB, 1MiB, 2MiB, 4MiB, 8MiB, and 16MiB.
pgBackRest Command Option (--cmd)
pgBackRest command.
pgBackRest can generate a command string, for example when restore generates the restore_command setting. It uses the command that started the pgBackRest process unless you specify the cmd option.
CAUTION:
Wrapping the pgBackRest command may cause unpredictable behavior and is not recommended.
SSH Client Command Option (--cmd-ssh)
SSH client command.
Use this option to select a different SSH client or when the ssh command is not in $PATH.
Network Compress Level Option (--compress-level-network)
Network compression level.
Set the network compression level when compress-type=none and the command runs on a host other than the repository host. Compression reduces network traffic. When compress-type is not none, pgBackRest ignores compress-level-network and uses compress-level. This prevents compression of the same file twice.
Config Option (--config)
pgBackRest configuration file.
Use this option to select a configuration file other than the default.
Config Include Path Option (--config-include-path)
Path to additional pgBackRest configuration files.
pgBackRest combines files with the .conf extension in this location with its configuration file. The result is one configuration file.
Config Path Option (--config-path)
Base path of pgBackRest configuration files.
Set the default base path for --config and --config-include-path. Explicit command-line values for these options override this setting.
For example, specify only --config-path=/conf/pgbackrest to set the --config default to /conf/pgbackrest/pgbackrest.conf. This also sets the --config-include-path default to /conf/pgbackrest/conf.d.
I/O Timeout Option (--io-timeout)
I/O timeout.
Set the connection and read/write timeout in seconds.
The complete read/write operation can take longer than this timeout. However, it must make some progress before the timeout, even if only one byte.
Neutral Umask Option (--neutral-umask)
Use a neutral umask.
Set the umask to 0000 to control repository permissions. The default directory mode is 0750. The default file mode is 0640.
To use the executing user’s umask, set neutral-umask=n in the configuration file or --no-neutral-umask on the command line.
Set Process Priority Option (--priority)
Set process priority.
Set the process priority, or niceness, used by the kernel scheduler. Positive values decrease priority. Negative values increase priority. Processes usually lack permission to increase their priority.
Process Maximum Option (--process-max)
Max processes to use for compress/transfer.
Each process compresses and transfers data to increase command speed. Do not set process-max so high that database performance decreases.
Protocol Timeout Option (--protocol-timeout)
Protocol timeout.
Set how many seconds a local or remote process waits for a new protocol message. This prevents an indefinite wait.
NOTE: The
protocol-timeoutoption must be greater than thedb-timeoutoption.
Keep Alive Option (--sck-keep-alive)
Keep-alive enable.
Enables keep-alive messages on socket connections.
Stanza Option (--stanza)
Defines the stanza.
A stanza contains the configuration for a PostgreSQL database cluster. It defines the cluster location, backup method, archive options, and other settings. Most database servers have one PostgreSQL cluster and one stanza. A backup server has a stanza for each cluster that needs a backup.
Choose a stanza name that describes the databases in the cluster. The primary and all replicas use the same stanza name. A functional name, such as app or dw, is preferable to a local cluster name, such as main or prod.
Keep Alive Count Option (--tcp-keep-alive-count)
Keep-alive count.
Set how many TCP keep-alive messages can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Keep Alive Idle Option (--tcp-keep-alive-idle)
Keep-alive idle time.
Set how many seconds of network inactivity must pass before the operating system sends a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Keep Alive Interval Option (--tcp-keep-alive-interval)
Keep-alive interval time.
Set how many seconds to wait before retransmitting a TCP keep-alive message that has no acknowledgement.
This option is available on systems that support the TCP_KEEPINTVL socket option.
TLSv1.2 cipher suites Option (--tls-cipher-12)
Allowed TLSv1.2 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. The example is suitable unless you have specific security requirements. By default, this option is unset and the underlying OpenSSL library default applies.
TLSv1.3 cipher suites Option (--tls-cipher-13)
Allowed TLSv1.3 cipher suites.
All TLS connections between the pgBackRest client and server use encryption. Connections to object stores, such as S3, also use encryption by default.
NOTE: The absolute minimum security level for any transport connection is TLSv1.2.
Change the accepted cipher suites if necessary. By default, this option is unset and the underlying OpenSSL library default applies.
Log Options
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
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 errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Std Error Log Level Option (--log-level-stderr)
Level for stderr logging.
Select the log levels that write to stderr instead of stdout, which log-level-console controls. Output to stderr excludes the timestamp and process.
The following log levels are supported:
off- No logging at all (not recommended)error- Log only errorswarn- Log warnings and errorsinfo- Log info, warnings, and errorsdetail- Log detail, info, warnings, and errorsdebug- Log debug, detail, info, warnings, and errorstrace- Log trace (very verbose debugging), debug, info, warnings, and errors
Log Path Option (--log-path)
Path where log files are stored.
pgBackRest stores log files in this path. If log-level-file=off, no log path is necessary.
Log Subprocesses Option (--log-subprocess)
Enable logging in subprocesses.
Enable file logging for subprocesses created by this process. Use the level specified by log-level-file.
Log Timestamp Option (--log-timestamp)
Enable timestamp in logging.
Include timestamps in console and file logs. Disable this option for special uses, such as documentation generation.
Maintainer Options
Force PostgreSQL Version Option (--pg-version-force)
Force PostgreSQL version.
Use the specified PostgreSQL version instead of the version detected from pg_control or WAL headers. This is mainly useful for PostgreSQL forks or development versions whose values differ from the release version. The version that PostgreSQL reports through server_version_num must match the forced version.
WARNING:
Use this option with care. pgBackRest still reads pg_control and WAL headers in the official open-source PostgreSQL format for the specified version. Changes to fields that pgBackRest uses can cause unexpected behavior. Generally, the fork must add all custom struct members after the standard PostgreSQL members for this option to work correctly.
Repository Options
Set Repository Option (--repo)
Set repository.
Set the repository for a command to operate on.
For example, select a repository for a restore instead of letting pgBackRest choose one.
Azure Repository Container Option (--repo-azure-container)
Azure repository container.
Azure container used to store the repository.
Set repo-path=/ to store the repository in the container root. Usually, specify a prefix such as /repo. The container can then also store logs and other Azure-generated content.
Azure Repository Key Type Option (--repo-azure-key-type)
Azure repository key type.
The following types are supported for authorization:
shared- Shared keysas- Shared access signatureauto- Automatically authorize using Azure managed identities
Azure Repository URI Style Option (--repo-azure-uri-style)
Azure URI Style.
The following URI styles are supported:
host- Connect toaccount.endpointhost.path- Connect toendpointhost and prepend account to URIs.
Repository Cipher Type Option (--repo-cipher-type)
Cipher used to encrypt the repository.
The following cipher types are supported:
none- The repository is not encryptedaes-256-cbc- Advanced Encryption Standard with 256 bit key length
pgBackRest always encrypts data on the client, even when the repository type, such as S3, supports encryption.
GCS Repository Bucket Option (--repo-gcs-bucket)
GCS repository bucket.
GCS bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other GCS-generated content.
GCS Repository Endpoint Option (--repo-gcs-endpoint)
GCS repository endpoint.
Set the endpoint for the storage service connection. You can select a local GCS server or another endpoint.
GCS Repository Key Type Option (--repo-gcs-key-type)
GCS repository key type.
The following types are supported for authorization:
auto- Authorize using the instance service account.service- Service account from locally stored key.token- For local testing, e.g.fakegcs.
When repo-gcs-key-type=service, pgBackRest reloads credentials when it renews the authentication token.
GCS Repository Project ID Option (--repo-gcs-user-project)
GCS project ID.
GCS project ID used to determine request billing.
Repository Host Option (--repo-host)
Repository host when operating remotely.
This setting is not necessary for backups and archives on a locally mounted filesystem.
Deprecated Name: backup-host
Repository Host Certificate Authority File Option (--repo-host-ca-file)
Repository host certificate authority file.
Use a CA file other than the system default for connecting to the repository host.
Repository Host Certificate Authority Path Option (--repo-host-ca-path)
Repository host certificate authority path.
Use a CA path other than the system default for connecting to the repository host.
Repository Host Certificate File Option (--repo-host-cert-file)
Repository host certificate file.
pgBackRest sends this certificate to the repository host to prove the client identity.
Repository Host Command Option (--repo-host-cmd)
Repository host pgBackRest command.
Set this option only when the pgBackRest command path differs between the local and repository hosts. Otherwise, the repository host uses the local command path.
Deprecated Name: backup-cmd
Repository Host Configuration Option (--repo-host-config)
pgBackRest repository host configuration file.
Set the repository host configuration file location. This is necessary only when it differs from the local configuration file location.
Deprecated Name: backup-config
Repository Host Configuration Include Path Option (--repo-host-config-include-path)
pgBackRest repository host configuration include path.
Set the repository host configuration include path. This is necessary only when it differs from the local configuration include path.
Repository Host Configuration Path Option (--repo-host-config-path)
pgBackRest repository host configuration path.
Set the repository host configuration path. This is necessary only when it differs from the local configuration path.
Repository Host Key File Option (--repo-host-key-file)
Repository host key file.
This key proves that the certificate owner sent the client certificate.
Repository Host Port Option (--repo-host-port)
Repository host port when repo-host is set.
Use this option to specify a non-default port for the repository host protocol.
NOTE: When
repo-host-type=ssh,repo-host-porthas no default. The command specified bycmd-sshsupplies its configured port.
Deprecated Name: backup-ssh-port
Repository Host Protocol Type Option (--repo-host-type)
Repository host protocol type.
The following protocol types are supported:
ssh- Secure Shell.tls- pgBackRest TLS server.
Repository Host User Option (--repo-host-user)
Repository host user when repo-host is set.
Set the user for repository host operations. Prefer a separate user, such as pgbackrest, to the postgres user. If PostgreSQL runs on the repository host, you can add postgres to the pgbackrest group. This gives it read access to the repository without permission to damage its contents accidentally.
Deprecated Name: backup-user
Repository Path Option (--repo-path)
Path where backups and archive are stored.
The repository is where pgBackRest stores backups and archives WAL segments.
To estimate repository space, take some backups. Record the sizes of full, incremental, and differential backups (full/incr/diff). Measure how much WAL the database generates each day. These measurements give an approximate space requirement. Requirements will probably change as the database changes.
S3 Repository Bucket Option (--repo-s3-bucket)
S3 repository bucket.
S3 bucket used to store the repository.
Set repo-path=/ to store the repository in the bucket root. Usually, specify a prefix such as /repo. The bucket can then also store logs and other AWS-generated content.
S3 Repository Endpoint Option (--repo-s3-endpoint)
S3 repository endpoint.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the repo-storage-ca-file, repo-storage-ca-path, repo-storage-host, repo-storage-port, and repo-storage-verify-tls options may be useful.
S3 Repository Key Type Option (--repo-s3-key-type)
S3 repository key type.
The following types are supported:
shared- Shared keysauto- Automatically retrieve temporary credentialsweb-id- Automatically retrieve web identity credentialspod-id- Automatically retrieve EKS pod identity credentialsprocess- Retrieve credentials by executing a process
S3 Repository KMS Key ID Option (--repo-s3-kms-key-id)
S3 repository KMS key.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 Authentication Process Command Option (--repo-s3-process-cmd)
S3 authentication process command.
Set the command and optional arguments that retrieve temporary S3 credentials. The first list entry is the command. The remaining entries are its parameters.
The process must output JSON with AccessKeyId, SecretAccessKey, SessionToken, and Expiration fields. pgBackRest refreshes credentials automatically before they expire. See Process Credential Provider for the format.
S3 Repository Region Option (--repo-s3-region)
S3 repository region.
The AWS region where the bucket was created.
S3 Repository Requestor Pays Option (--repo-s3-requester-pays)
S3 repository requester pays.
Enables S3 requester pays.
S3 Repository Role Option (--repo-s3-role)
S3 repository role.
When repo-s3-key-type=auto, set the AWS role name used to retrieve temporary credentials. Use the name, not the full ARN.
S3 Repository Service Option (--repo-s3-service)
S3 signing service.
Set the signing service for SigV4 authentication. The default is s3 for standard S3 endpoints. For an S3 Outposts endpoint, use s3-outposts.
S3 Repository STS Endpoint Option (--repo-s3-sts-host)
S3 repository STS endpoint.
When repo-s3-key-type=web-id, this endpoint retrieves temporary credentials. To use regional STS, select a regional endpoint, such as sts.us-east-1.amazonaws.com. Regional STS might be necessary for GovCloud or China regions, or to reduce latency.
S3 Repository URI Style Option (--repo-s3-uri-style)
S3 URI Style.
The following URI styles are supported:
host- Connect tobucket.endpointhost.path- Connect toendpointhost and prepend bucket to URIs.
SFTP Repository Host Option (--repo-sftp-host)
SFTP repository host.
The SFTP host containing the repository.
SFTP Repository Host Fingerprint Option (--repo-sftp-host-fingerprint)
SFTP repository host fingerprint.
Generate the SFTP host fingerprint with the hash type specified by repo-sftp-host-key-hash-type. Use awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. SSH host keys are usually in /etc/ssh.
SFTP Host Key Check Type Option (--repo-sftp-host-key-check-type)
SFTP host key check type.
The following SFTP host key check types are supported:
strict- pgBackRest never adds host keys to ~/.ssh/known_hosts automatically. It refuses connections when a host key changes or is absent from the known hosts files. Add each new host manually.accept-new- pgBackRest automatically adds new host keys to the user’s known hosts file. It refuses connections when a host key changes.fingerprint- pgBackRest compares the host key with therepo-sftp-host-fingerprintvalue.none- pgBackRest does not check host keys.
SFTP Repository Host Key Hash Type Option (--repo-sftp-host-key-hash-type)
SFTP repository host key hash type.
Set the hash type used to calculate the remote host key digest at SSH startup. Newer libssh2 versions support sha256 as well as md5 and sha1.
SFTP Repository Host Port Option (--repo-sftp-host-port)
SFTP repository host port.
SFTP repository host port.
SFTP Repository Host User Option (--repo-sftp-host-user)
SFTP repository host user.
User on the host used to store the repository.
SFTP Known Hosts File Option (--repo-sftp-known-host)
SFTP known hosts file.
Set a known hosts file to check during SFTP authentication. By default, pgBackRest searches ~/.ssh/known_hosts, ~/.ssh/known_hosts2, /etc/ssh/ssh_known_hosts, and /etc/ssh/ssh_known_hosts2. If you configure file paths, it searches those files. Use absolute paths or paths that start with a tilde. Repeat repo-sftp-known-host to specify multiple files. To check known hosts files, do not set repo-sftp-host-fingerprint.
See also the repo-sftp-host-check-type option.
SFTP Repository Private Key File Option (--repo-sftp-private-key-file)
SFTP private key file.
SFTP private key file used for authentication.
SFTP Repository Public Key File Option (--repo-sftp-public-key-file)
SFTP public key file.
Set the SFTP public key file for authentication. This file is optional for builds that use OpenSSL. Other builds require it.
Repository Storage CA File Option (--repo-storage-ca-file)
Repository storage CA file.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-file, repo-s3-ca-file
Repository Storage TLS CA Path Option (--repo-storage-ca-path)
Repository storage CA path.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Deprecated Names: repo-azure-ca-path, repo-s3-ca-path
Repository Storage Host Option (--repo-storage-host)
Repository storage host.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Deprecated Names: repo-azure-host, repo-s3-host
Repository Storage Port Option (--repo-storage-port)
Repository storage port.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Deprecated Names: repo-azure-port, repo-s3-port
Repository Storage Tag Option (--repo-storage-tag)
Repository storage tag(s).
For an object store repository, such as S3, specify the tags to add to objects. Repeat this option to add multiple tags.
pgBackRest cannot change these tags. Before you run stanza-create, set them correctly to give the entire repository uniform tags.
Repository Storage Upload Chunk Size Option (--repo-storage-upload-chunk-size)
Repository storage upload chunk size.
Object stores, such as S3, support uploads in chunks for files too large to fit in memory. For smaller files, chunks also reduce the memory used for uploads.
Larger chunks usually improve performance because they reduce upload requests. More files can fit in a single request without division into chunks. However, larger chunks use more memory. Each process needs a chunk buffer, so a larger process-max value also increases total memory use.
Valid chunk sizes depend on the storage type and platform. For example, AWS S3 requires a minimum chunk size of 5MiB. To find minimum and maximum values, search for the term that matches your storage type. Use “part size” for AWS S3, “chunk size” for GCS, and “block size” for Azure.
By default, PostgreSQL creates files no larger than 1GiB. For larger files, pgBackRest increases the chunk size in increments, up to the allowed maximum, to complete the upload.
Repository Storage Certificate Verify Option (--repo-storage-verify-tls)
Repository storage certificate verify.
Enable or disable verification of the storage server TLS certificate, for example for S3 or Azure. Disable verification only for testing or other cases that use a self-signed certificate.
Deprecated Names: repo-azure-verify-tls, repo-s3-verify-ssl, repo-s3-verify-tls
Target Time for Repository Option (--repo-target-time)
Target time for repository.
Set the point in time at which commands read a repository on versioned storage. This lets you recover data deleted or corrupted by user error or malware.
S3, GCS, and Azure support versioned storage, but usually disable it by default. In addition to versioning, consider S3 object locking or GCS and Azure soft delete.
When you specify repo-target-time, you must also specify repo. Some repository types probably will not support versioning. Recovery usually targets one repository.
Storage timestamps must be <= the specified timestamp. pgBackRest truncates milliseconds from the specified timestamp.
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
azure- Azure Blob Storage Servicecifs- Likeposix, but disables links and directory fsyncsgcs- Google Cloud Storageposix- Posix-compliant file systemss3- AWS Simple Storage Servicesftp- Secure File Transfer Protocol
For an NFS mount used as a posix repository, follow the PostgreSQL filesystem rules. See Creating a Database Cluster - File Systems.
20 - Version Command (version)
version command options and behavior.Source: pgBackRest Command Docs: version
Display the installed pgBackRest version.
Command Options
Output Option (--output)
Output type.
The following output types are supported:
text- Display the installed pgBackRest version as text.num- Display the installed pgBackRest version as an integer.