The following option types are used:
String: A text string, commonly an identifier, password, etc.
Command line example:
Configuration file example:
Path: Used to uniquely identify a location in a directory structure. Paths must begin with /, double // is not allowed, and no ending / is expected.
Command line example:
Configuration file example:
Boolean: Enables or disables the option. Only y/n are valid argument values.
Command line examples:
Configuration file examples:
Integer: Used for ports, retention/retry counts, parallel processes allowed, etc.
Command line example:
Configuration file example:
Size: Used for buffer sizes, disk usage, etc. Size can be specified in bytes (default) or KiB, MiB, GiB, TiB, or PiB where the multiplier is a power of 1024. For example, the case-insensitive value 5GiB (or 5GB, 5g) can be used instead of 5368709120. Fractional values such as 2.5GiB are not allowed, use 2560MiB instead.
Command line example:
Configuration file example:
Time: Time in seconds.
Command line example:
Configuration file example:
List: Option may be provided multiple times.
Command line example:
Configuration file example, each on its own line:
Key/Value: Option may be provided multiple times in the form
Command line example:
Configuration file example, each on its own line:
The
The following log levels are supported:
The following log levels are supported:
Specifies which log levels will output to
The following log levels are supported:
The log path provides a location for
Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.
Enable file logging for any subprocesses created by this process using the log level specified by
The
By default only the
Enable this option to run a command as root anyway. However, it is far better to run
Allow beta features to be enabled but do not actually enable them. Beta features need to be separately enabled using related options.
Buffer size used for copy, compress, encrypt, and other operations. The number of buffers used depends on options and each operation may use additional memory, e.g.
Allowed values are
Use a specific SSH client command when an alternate is desired or the
Backup files are compatible with command-line compression tools.
This option is now deprecated. The
The following compression types are supported:
Sets the level to be used for file compression when
Sets the network compression level when
Sets the timeout, in seconds, for queries against the database. This includes the backup start/stop functions which can each take a substantial amount of time. Because of this the timeout should be kept high unless you know that these functions will return quickly (i.e. if you have set
During a restore, by default the
During a backup, this option will use checksums instead of the timestamps to determine if files will be copied.
Timeout, in seconds, used for connections and read/write operations.
Note that the entire read/write operation does not need to complete within this timeout but some progress must be made, even if it is only a single byte.
The number of retries for jobs run in the local process, e.g. file backup.
The first retry is always performed immediately. This option specifies the interval to wait (in seconds) before performing each additional retry.
The lock path provides a location for
Sets the umask to 0000 so modes in the repository are created in a sensible way. The default directory mode is 0750 and default file mode is 0640.
To use the executing user's umask instead specify
Defines how much priority (i.e. niceness) will be given to the process by the kernel scheduler. Positive values decrease priority and negative values increase priority. In most case processes do not have permission to increase their priority.
This path is used to store data for the asynchronous
The asynchronous
The asynchronous
The data stored in the spool path is not strictly temporary since it can and should survive a reboot. However, loss of the data in the spool path is not a problem.
The spool path is intended to be located on a local Posix-compatible filesystem, not a remote filesystem such as
Each process will perform compression and transfer to make the command run faster, but don't set
Sets the timeout, in seconds, that the local or remote process will wait for a new message to be received on the protocol layer. This prevents processes from waiting indefinitely for a message.
Enable blocking on socket connections.
Enables keep-alive messages on socket connections.
Specifies the number of TCP keep-alive messages that can be lost before the connection is considered dead.
This option is available on systems that support the TCP_KEEPCNT socket option.
Specifies the amount of time (in seconds) with no network activity after which the operating system should send a TCP keep-alive message.
This option is available on systems that support the TCP_KEEPIDLE socket option.
Specifies the amount of time (in seconds) after which a TCP keep-alive message that has not been acknowledged should be retransmitted.
This option is available on systems that support the TCP_KEEPINTVL socket option.
All TLS connections between the
The accepted cipher suites can be adjusted if need arises. The example is reasonable choice unless you have specific security requirements. If unset (the default), the default of the underlying
All TLS connections between the
The accepted cipher suites can be adjusted if need arises. If unset (the default), the default of the underlying
Maintainer options are intended to support
It is the responsibility of the fork maintainer to test
Enabled by default, this option checks the WAL header against the
Therefore, disabling this check is fairly safe but should only be done when needed, e.g. if the WAL is encrypted.
Enabled by default, this option adds page header checks.
Disabling this option should be avoided except when necessary, e.g. if pages are encrypted.
The specified
The
Indexing: All
The
Azure account used to store the repository.
Azure container used to store the repository.
Endpoint used to connect to the blob service. The default is generally correct unless using Azure Government.
For custom/test configurations the
A shared key or shared access signature depending on the
The following types are supported for authorization:
The following URI styles are supported:
Block incremental allows for more granular backups by splitting files into blocks that can be backed up independently. This saves space in the repository and can improve delta restore performance because individual blocks can be fetched without reading the entire file from the repository.
The block size for a file is determined based on the file size and age. Generally, older/larger files will get larger block sizes. If a file is old enough, it will not be backed up using block incremental.
Block incremental is most efficient when enabled for all backup types, including full. This makes the full a bit larger but subsequent differential and incremental backups can make use of the block maps generated by the full backup to save space.
Map file age (in days) to a block multiplier. Files that have not been modified recently are less likely to be modified in the future, so the block size is multiplied to reduce the map size. By default, if the file is old enough it will not be stored as a block incremental.
Map block size to checksum size. Smaller checksums save space in the map but may not be able to reliably detect changes in the block.
Map file size to block size. Block size is the minimum unit that will be stored in the block incremental. Smaller sizes allow for more granular incremental backups but larger sizes mean smaller maps.
A super block contains multiple blocks to improve compression efficiency. The disadvantage is that block reads must read from the beginning of the super block.
Super block size for full backups. This is generally larger than
Bundle (combine) smaller files to reduce the total number of files written to the repository. Writing fewer files is generally more efficient, especially on object stores such as
Defines the target size for files that will be added to a single bundle. The uncompressed bundle size may be as large as
In general, it is not a good idea to set this option too high because retries will need to redo the entire bundle.
Size limit for files that will be included in bundles. Files larger than this size will be stored separately.
Bundled files cannot be reused when a backup is resumed, so this option controls the files that can be resumed, i.e. higher values result in fewer resumable files.
GCS bucket used to store the repository.
Endpoint used to connect to the storage service. May be updated to use a local GCS server or alternate endpoint.
A token or service key file depending on the
The following types are supported for authorization:
When
GCS project ID used to determine request billing.
The following protocol types are supported:
When backing up and archiving to a locally mounted filesystem this setting is not required.
Use a CA file other than the system default for connecting to the repository host.
Use a CA path other than the system default for connecting to the repository host.
Sent to repository host to prove client identity.
Proves client certificate was sent by owner.
Required only if the path to the
Sets the location of the configuration file on the repository host. This is only required if the repository host configuration file is in a different location than the local configuration file.
Sets the location of the configuration include path on the repository host. This is only required if the repository host configuration include path is in a different location than the local configuration include path.
Sets the location of the configuration path on the repository host. This is only required if the repository host configuration path is in a different location than the local configuration path.
Defines the user that will be used for operations on the repository host. Preferably this is not the
Use this option to specify a non-default port for the repository host protocol.
Enable hard-linking of files in differential and incremental backups to their full backups. This gives the appearance that each backup is a full backup at the file-system level. Be careful, though, because modifying files that are hard-linked can affect all the backups in the set.
Indicates that the repository for the specified index is local and any repository host settings for that index (e.g.
The repository is where
It may be difficult to estimate in advance how much space you'll need. The best thing to do is take some backups then record the size of different types of backups (full/incr/diff) and measure the amount of WAL generated per day. This will give you a general idea of how much space you'll need, though of course requirements will likely change over time as your database evolves.
When a full backup expires, all differential and incremental backups associated with the full backup will also expire. When the option is not defined a warning will be issued. If indefinite retention is desired then set the option to the max value.
Determines whether the
If set to
If set to
Note that a backup must be successfully completed before it will be considered for retention. For example, if
When a differential backup expires, all incremental backups associated with the differential backup will also expire. When not defined all differential backups will be kept until the full backups they depend on expire.
Note that full backups are included in the count of differential backups for the purpose of expiration. This slightly reduces the number of differential backups that need to be retained in most cases.
If set to
If this value is not set and
This option must be set if
A copy of the backup manifest is stored in the
Set
When a full backup history manifest is expired, all differential and incremental backup history manifests associated with the full backup also expire.
AWS key used to access this bucket.
AWS secret key used to access this bucket.
The following types are supported:
AWS security token used with temporary credentials.
Enables S3 server-side encryption using the specified AWS key management service key.
S3 bucket used to store the repository.
The AWS endpoint should be valid for the selected region.
For custom/test configurations the
Command (and optional arguments) to execute for retrieving temporary S3 credentials. The first list entry is the command and the remaining entries are passed as parameters.
The process must output JSON containing
The AWS role name (not the full ARN) used to retrieve temporary credentials when
The AWS region where the bucket was created.
Enables S3 server-side encryption using the specified customer key.
Enables S3 requester pays.
The S3 signing service used in SigV4 authentication. Defaults to
The STS endpoint used to retrieve temporary credentials when
The following URI styles are supported:
The SFTP host containing the repository.
SFTP repository host fingerprint generation should match the awk '{print $2}' ssh_host_xxx_key.pub | base64 -d | (md5sum or sha1sum) -b. The ssh host keys are normally found in the
The following SFTP host key check types are supported:
SFTP repository host key hash type. Declares the hash type to be used to compute the digest of the remote system's host key on SSH startup. Newer versions of
SFTP repository host port.
User on the host used to store the repository.
A known hosts file to search for an SFTP host match during authentication. When unspecified,
SFTP private key file used for authentication.
Passphrase used to access the private key. This is an optional feature when creating an SSH public/private key pair.
SFTP public key file used for authentication. Optional if compiled against OpenSSL, required if compiled against a different library.
Use a CA file other than the system default for storage (e.g. S3, Azure) certificates.
Use a CA path other than the system default for storage (e.g. S3, Azure) certificates.
Determines the number of requests to prefetch when reading from object stores, e.g.
Note that the number of open requests per read will be one greater than prefetch, since the initial read cannot be prefetched.
Connect to a host other than the storage (e.g. S3, Azure) endpoint. This is typically used for testing.
Port to use when connecting to the storage (e.g. S3, Azure) endpoint (or host if specified).
Bundles may contain data that is not needed during restore, for example files that already exist. This option skips over unneeded data without starting a new read request on object stores. This is generally faster since the latency on new read requests is higher than continuing a read already in progress. It is also less expensive for most storage classes.
Specify tags that will be added to objects when the repository is an object store (e.g. S3). The option can be repeated to add multiple tags.
There is no provision in
Object stores such as S3 allow files to be uploaded in chunks when the file is too large to be stored in memory. Even if the file can be stored in memory, it is more memory efficient to limit the amount of memory used for uploads.
A larger chunk size will generally lead to better performance because it will minimize upload requests and allow more files to be uploaded in a single request rather than in chunks. The disadvantage is that memory usage will be higher and because the chunk buffer must be allocated per process, larger
Note that valid chunk sizes vary by storage type and by platform. For example, part size
for chunk size
for block size
for
If a file is larger than 1GiB (the maximum size
This option provides the ability to enable/disable verification of the storage (e.g. S3, Azure) server TLS certificate. Disabling should only be used for testing or other scenarios where a certificate has been self-signed.
Enable creation of the
While this feature is likely not useful for the vast majority of users it remains on by default for legacy purposes. However, it may be useful to disable symlinks for Posix-like storage that does not support them.
The target time defines the time that commands use to read a repository on versioned storage. This allows the command to read the repository as it was at a point-in-time in order to recover data that has been deleted or corrupted by user accident or malware.
Versioned storage is supported by
When the
Note that comparisons to the storage timestamp are <= the timestamp provided and milliseconds are truncated from the timestamp when provided.
The following repository types are supported:
When an
The following cipher types are supported:
Note that encryption is always performed client-side even if the repository type (e.g. S3) supports encryption.
Passphrase used to encrypt/decrypt files of the repository.
The
Users can attach informative key/value pairs to the backup. This option may be used multiple times to attach multiple annotations.
Annotations are output by the
Checks that all WAL segments required to make the backup consistent are present in the WAL archive. It's a good idea to leave this as the default unless you are using another method for archiving.
This option must be enabled if
This slightly paranoid option protects against corruption in the WAL segment archive by storing the WAL segments required for consistency directly in the backup. WAL segments are still stored in the archive so this option will use additional space.
It is best if the
On restore, the WAL segments will be present in restore_command.
The
Enabled by default, this option disallows
WAL segments pushed from a standby server might be logically the same as WAL segments pushed from the primary but have different checksums. Disabling archiving from multiple sources is recommended to avoid conflicts.
Enable backup from standby to reduce load on the primary cluster. This option requires that both the
The following modes are supported:
Directs
Failures in checksum validation will not abort a backup. Rather, warnings will be emitted in the log (and to the console with default settings) and the list of invalid pages will be stored in the backup manifest.
All exclusions are relative to
Be careful using this feature -- it is very easy to exclude something critical that will make the backup inconsistent. Be sure to test your restores!
All excluded files will be logged at
This option should not be used to exclude
Multiple exclusions may be specified on the command-line or in a configuration file.
Defines how often the manifest will be saved during a backup. Saving the manifest is important because it stores the checksums and allows the resume function to work efficiently. The actual threshold used is 1% of the backup size or
The setting is enabled by default. Use caution when disabling this option as doing so will result in retaining all backups and archives indefinitely, which could cause your repository to run out of space. The
When
Defines whether the resume feature is enabled. Resume can greatly reduce the amount of time required to run a backup after a previous backup of the same type has failed. It adds complexity, however, so it may be desirable to disable in environments that do not require the feature.
Forces a checkpoint (by passing
This will only be done if an exclusive advisory lock can be acquired to demonstrate that the prior failed backup process has really stopped.
This feature is not supported for
The setting is disabled by default because it assumes that pg_start_backup() so are not exclusive.
The
Enables asynchronous operation for the
Asynchronous operation is more efficient because it can reuse connections and take advantage of parallelism. See the
Specifies the maximum size of the
Retry a WAL segment that was previously reported as missing by the
Disabling this option allows
When disabling this option it is important to ensure that the spool path for the stanza is empty. The
In asynchronous mode the
This option limits the amount of WAL processed per run so the process exits and is spawned again by the next
After the limit is reached, the following will happen:
If this occurs then the archive log stream will be interrupted and PITR will not be possible past that point. A new backup will be required to regain full restore capability.
In asynchronous mode the entire queue will be dropped to prevent spurts of WAL getting through before the queue limit is exceeded again.
In asynchronous mode this limit is only checked at the start of each
The purpose of this feature is to prevent the log volume from filling up at which point
Set maximum time, in seconds, to wait for each WAL segment to reach the
The
This option allows archiving to be preserved or disabled on a restored cluster. This is useful when the cluster must be promoted to do some work but is not intended to become the new primary. In this case it is not a good idea to push WAL from the cluster into the repository.
The following modes are supported:
NOTE: This option is not available on
Databases excluded will be restored as sparse, zeroed files to save space but still allow
When used in combination with the
This feature allows only selected databases to be restored. Databases not specifically included will be restored as sparse, zeroed files to save space but still allow
The
See Restore Selected Databases for additional information and caveats.
By default symlinked directories and files are restored as normal directories and files in $PGDATA. This is because it may not be safe to restore symlinks to their original destinations on a system other than where the original backup was performed. This option restores all the symlinks just as they were on the original system where the backup was performed.
Allows the destination file or path of a symlink to be changed on restore. This is useful for restoring to systems that have a different storage layout than the original system where the backup was generated.
See Server Configuration for details on
For
Since
Moves a tablespace to a new location during the restore. This is useful when tablespace locations are not the same on a replica, or an upgraded system has different mount points.
Tablespace locations are not stored in pg_tablespace so moving tablespaces can be done with impunity. However, moving a tablespace to the
Tablespaces are restored into their original locations by default. This behavior can be modified for each tablespace with the
The path specified will be the parent path used to create all the tablespaces in the backup.
The
Clients are authorized on the server by verifying their certificate and checking their certificate CN (Common Name) against a list on the server configured with the
A client CN can be authorized for as many stanzas as needed by providing a comma-separated list to the
Checks that client certificates are signed by a trusted certificate authority.
Sent to the client to show the server identity.
Proves server certificate was sent by the owner.
IP address the server will listen on for client requests.
Port the server will listen on for client requests.
A stanza defines the backup configuration for a specific
Indexing: All
Required only if the path to the
Sets the location of the configuration file on the
Sets the location of the configuration include path on the
Sets the location of the configuration path on the
Used for backups where the
Use a CA file other than the system default for connecting to the
Use a CA path other than the system default for connecting to the
Sent to
Proves client certificate was sent by owner.
The following protocol types are supported:
This user will also own the remote
The database name used when connecting to
Note that for legacy reasons the setting of the
Indicates that
This should be the same as the
The
Port that
The unix socket directory that was specified when
The database user name used when connecting to
Use this option to specify a non-default port for the
Commands are used to execute the various
Non-boolean options configured in
The
Any option may be set in an environment variable using the
Command-line options override environment options which override config file options.
See Configuration Introduction for information on option types
Annotations included with the
When multiple repositories are configured,
See Perform a Backup for more details and examples.
Accepts a WAL segment from
The
This command is used by
When multiple repositories are configured, WAL will be fetched from the repositories in priority order (e.g.
The
The pg_switch_xlog()/pg_switch_wal() cannot be performed on the standby, the command will only test the repository configuration.
Note that pg_create_restore_point('pgBackRest Archive Check') and pg_switch_xlog()/pg_switch_wal() are called to force
Archived WAL is retained by default for backups that have not expired, however, although not recommended, this schedule can be modified per repository with the retention-archive options. See section Archive Retention for details and examples.
The
Get information from a manifest including the restore strategy.
Similar to the unix
If the repository is encrypted then
If more than one repository is configured, the command will default to the highest priority repository (e.g.
Similar to the unix
The default text output prints one file name per line. JSON output is available by specifying
If more than one repository is configured, the command will default to the highest priority repository (e.g.
Similar to the unix
If more than one repository is configured, the command will default to the highest priority repository (e.g.
Similar to the unix
If more than one repository is configured, the command will default to the highest priority repository (e.g.
The restore command automatically defaults to selecting the latest backup from the first repository where backups exist (see Quick Start - Restore a Backup). The order in which the repositories are checked is dictated by the
When PITR of
Replication slots are not included per recommendation of
The
For machine-readable output use
To speed up execution, limit the output to only progress information by specifying
Each stanza has a separate section and it is possible to limit output to a single stanza with the
The '
The backups are displayed oldest to newest. The oldest backup will always be a full backup (indicated by an
The '
The '
The '
The '
The '
Three levels of help are provided. If no command is specified then general help will be displayed. If a command is specified (e.g.
The
Ping a
If no host is specified on the command-line then the
If the
Does not allow any new
Verify determines if the backups and archives in a repository are valid.
Displays installed
The
See Create the Stanza for more information and an example.
Immediately after upgrading
The
To delete a stanza:
Once the command successfully completes, it is the responsibility of the user to remove the stanza from all
A stanza may only be deleted from one repository at a time. To delete the stanza from multiple repositories, repeat the