The {[project]} Configuration Reference details all configuration options. can be used entirely with command-line parameters but a configuration file is more practical for installations that are complex or set a lot of options. The default location for the configuration file is /etc/pgbackrest.conf.The log section defines logging-related settings.Level for file logging.The following log levels are supported:
off - No logging at all (not recommended)
error - Log only errors
warn - Log warnings and errors
info - Log info, warnings, and errors
detail - Log detail, info, warnings, and errors
debug - Log debug, detail, info, warnings, and errors
errorLevel for stderr logging.Specifies which log levels must will be output to stderr rather than stdout (specified by log-level-console). The timestamp and process will not be output to stderr.
The following log levels are supported:
off - No logging at all (not recommended)
error - Log only errors
warn - Log warnings and errors
info - Log info, warnings, and errors
detail - Log detail, info, warnings, and errors
debug - Log debug, detail, info, warnings, and errors
errorThe general section defines settings that are shared between multiple operations.Archive timeout.Set maximum time, in seconds, to wait for WAL segments to reach the archive. The timeout applies to the check command and to the backup command when waiting for WAL segments required to make the backup consistent to be archived.30Buffer size for file operations.Set the buffer size used for copy, compress, and uncompress functions. A maximum of 3 buffers will be in use at a time per process. An additional maximum of 256K per process may be used for zlib buffers.16384 - 838860832768Path to ssh client executable.Use a specific SSH client when an alternate is desired or the ssh executable is not in $PATH./usr/bin/sshUse gzip file compression.Backup files are compatible with command-line gzip tools.nCompression level for stored files.Sets the zlib level to be used for file compression when compress=y.0-99Compression level for network transfer when compress=n.Sets the zlib level to be used for protocol compression when compress=n and the database cluster is not on the same host as the backup. Protocol compression is used to reduce network traffic but can be disabled by setting compress-level-network=0. When compress=y the compress-level-network setting is ignored and compress-level is used instead so that the file is only compressed once. SSH compression is always disabled.0-91Database query timeout.Sets the timeout, in seconds, for queries against the database. This includes the pg_start_backup() and pg_stop_backup() functions which can each take a substantial amount of time. Because of this the timeout should be kept high unless you know that these functions will return quickly (i.e. if you have set startfast=y and you know that the database cluster will not generate many WAL segments during the backup).600Path where lock files are stored.The lock path provides a location for to create lock files to prevent conflicting operations from being run concurrently./backup/db/lockPath where log files are stored.The log path provides a location for to store log files. Note that if log-level-file=none then no log path is required./backup/db/logUse a neutral umask.Sets the umask to 0000 so modes in the repository are created in a sensible way. The default directory mode is 0750 and default file mode is 0640. The lock and log directories set the directory and file mode to 0770 and 0660 respectively.
To use the executing user's umask instead specify neutral-umask=n in the config file or --no-neutral-umask on the command line.nPath where WAL segments are spooled during async archiving.When asynchronous archiving is enabled needs a local directory to store WAL segments before they are compressed and moved to the repository. Depending on the volume of WAL generated this directory could become very large so be sure to plan accordingly.
The max-archive-mb option can be used to limit the amount of WAL that will be spooled locally./backup/db/spoolMax processes to use for compress/transfer.Each process will perform compression and transfer to make the command run faster, but don't set process-max so high that it impacts database performance.4Protocol timeout.Sets the timeout, in seconds, that the master or remote process will wait for a new message to be received on the protocol layer. This prevents processes from waiting indefinitely for a message. The protocol-timeout option must be greater than the db-timeout option.630Create convenience symlinks in repository.Creates the convenience link latest in the stanza directory and internal tablespace symlinks in each backup directory. The internal tablespace symlinks allow clusters to be brought up manually in-place using filesystem snapshots as long as the backup is not compressed.
This option should be disabled when the repository is located on a filesystem that does not support symlinks. No functionality will be affected, but certain manual operations on the repository may be less convenient.nRepository path where WAL segments and backups stored.The repository is where stores backup and archives WAL segments.
If you are new to backup then it will be difficult to estimate in advance how much space you'll need. The best thing to do is take some backups then record the size of different types of backups (full/incr/diff) and measure the amount of WAL generated per day. This will give you a general idea of how much space you'll need, though of course requirements will likely change over time as your database evolves./backup/db/backrestSync directories in repository.Syncs directories when writing to the repository. Not all file systems support directory syncs (e.g., NTFS) so this option allows them to be disabled.nThe backup section defines settings related to backup.Check that WAL segments are present in the archive before backup completes.Checks that all WAL segments required to make the backup consistent are present in the WAL archive. It's a good idea to leave this as the default unless you are using another method for archiving.nCopy WAL segments needed for consistency to the backup.This slightly paranoid option protects against corruption or premature expiration in the WAL segment archive by storing the WAL segments directly in the backup. PITR won't be possible without the WAL segment archive and this option also consumes more space.
Even though WAL segments will be restored with the backup, will ignore them if a recovery.conf file exists and instead use archive_command to fetch WAL segments. Specifying type=none when restoring will not create recovery.conf and force to use the WAL segments in pg_xlog. This will get the database cluster to a consistent state.y exe path on the backup host.Required only if the path to is different on the local and backup hosts. If not defined, the backup host exe path will be set the same as the local exe path.same as local/usr/lib/backrest/bin/pgbackrest backup host configuration file.Sets the location of the configuration file on the backup host. This is only required if the backup host configuration file is in a different location than the local configuration file./etc/pgbackrest_backup.confBackup host when operating remotely via SSH.Make sure that trusted SSH authentication is configured between the db host and the backup host.
When backing up to a locally mounted network filesystem this setting is not required.backup.domain.comBackup host user when backup-host is set.Defines the user that will be used for operations on the backup server. Preferably this is not the postgres user but rather some other user like backrest. If runs on the backup server the postgres user can be placed in the backrest group so it has read permissions on the repository without being able to damage the contents accidentally.backrestBackup from the standby cluster.Enable backup from standby to reduce load on the master cluster. This option requires that both the master and standby hosts be configured.yHardlink files between backups.Enable hard-linking of files in differential and incremental backups to their full backups. This gives the appearance that each backup is a full backup. Be careful, though, because modifying files that are hard-linked can affect all the backups in the set.yManifest save threshold during backup.Defines how often the manifest will be saved during a backup (in bytes). Saving the manifest is important because it stores the checksums and allows the resume function to work efficiently. The actual threshold used is 1% of the backup size or manifest-save-threshold, whichever is greater.5368709120Allow resume of failed backup.Defines whether the resume feature is enabled. Resume can greatly reduce the amount of time required to run a backup after a previous backup of the same type has failed. It adds complexity, however, so it may be desirable to disable in environments that do not require the feature.nForce a checkpoint to start backup quickly.Forces a checkpoint (by passing y to the fast parameter of pg_start_backup()) so the backup begins immediately. Otherwise the backup will start after the next regular checkpoint.
This feature only works in >= 8.4.yStop prior failed backup on new backup.This will only be done if an exclusive advisory lock can be acquired to demonstrate that the prior failed backup process has really stopped.
This feature relies on pg_is_in_backup() so only works on >= 9.3.
The setting is disabled by default because it assumes that is the only process doing exclusive online backups. It depends on an advisory lock that only sets so it may abort other processes that do exclusive online backups. Note that base_backup and pg_dump are safe to use with this setting because they do not call pg_start_backup() so are not exclusive.yThe archive section defines parameters when doing async archiving. This means that the archive files will be stored locally, then a background process will pick them and move them to the backup.Archive WAL segments asynchronously.WAL segments will be copied to the local repo, then a process will be forked to compress the segment and transfer it to the remote repo if configured. Control will be returned to as soon as the WAL segment is copied locally.yLimit size of the local asynchronous archive queue when archive-async=y.After the limit is reached, the following will happen:
will notify Postgres that the archive was successfully backed up, then DROP IT.
An error will be logged to the console and also to the Postgres log.
A stop file will be written in the lock directory and no more archive files will be backed up until it is removed.
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.
The purpose of this feature is to prevent the log volume from filling up at which point Postgres will stop completely. Better to lose the backup than have go down.
To start normal archiving again you'll need to remove the stop file which will be located at ${repo-path}/lock/${stanza}-archive.stop where ${repo-path} is the path set in the general section, and ${stanza} is the backup stanza.1024The restore section defines settings used for restoring backups.Restore only specified databases.This feature allows only selected databases to be restored. Databases not specifically included will be restored as sparse, zeroed files to save space but still allow to perform recovery. After recovery the databases that were not included will not be accessible but can be removed with the drop database command.
Note that built-in databases (template0, template1, and postgres) are always restored.
The {[dash]}-db-include option can be passed multiple times to specify more than one database to include.db_mainRestore all symlinks.By default symlinked directories and files are restored as normal directories and files in $PGDATA. This is because it may not be safe to restore symlinks to their original destinations on a system other than where the original backup was performed. This option restores all the symlinks just as they were on the original system where the backup was performed.yModify the destination of a symlink.Allows the destination file or path of a symlink to be changed on restore. This is useful for restoring to systems that have a different storage layout than the original system where the backup was generated.pg_xlog=/data/xlogSet an option in recovery.conf.See http://www.postgresql.org/docs/X.X/static/recovery-config.html for details on recovery.conf options (replace X.X with your version). This option can be used multiple times.
Note: The restore_command option will be automatically generated but can be overridden with this option. Be careful about specifying your own restore_command as is designed to handle this for you. Target Recovery options (recovery_target_name, recovery_target_time, etc.) are generated automatically by and should not be set with this option.
Since does not start after writing the recovery.conf file, it is always possible to edit/check recovery.conf before manually restarting.primary_conninfo=db.mydomain.comRestore a tablespace into the specified directory.Moves a tablespace to a new location during the restore. This is useful when tablespace locations are not the same on a replica, or an upgraded system has different mount points.
Since 9.2 tablespace locations are not stored in pg_tablespace so moving tablespaces can be done with impunity. However, moving a tablespace to the data_directory is not recommended and may cause problems. For more information on moving tablespaces http://www.databasesoup.com/2013/11/moving-tablespaces.html is a good resource.ts_01=/db/ts_01Restore all tablespaces into the specified directory.By default tablespaces are restored into their original locations and while this behavior can be modified by with the tablespace-map open it is sometime preferable to remap all tablespaces to a new directory all at once. This is particularly useful for development or staging systems that may not have the same storage layout as the original system where the backup was generated.
The path specified will be the parent path used to create all the tablespaces in the backup./data/tablespaceThe expire section defines how long backups will be retained. Expiration only occurs when the number of complete backups exceeds the allowed retention. In other words, if retention-full is set to 2, then there must be 3 complete backups before the oldest will be expired. Make sure you always have enough space for retention + 1 backups.Number of full backups to retain.When a full backup expires, all differential and incremental backups associated with the full backup will also expire. When the option is not defined a warning will be issued. If indefinite retention is desired then set the option to the max value.2Number of differential backups to retain.When a differential backup expires, all incremental backups associated with the differential backup will also expire. When not defined all differential backups will be kept until the full backups they depend on expire.3Backup type for WAL retention.If set to full will keep archive logs for the number of full backups defined by retention-archive. If set to diff (differential) will keep archive logs for the number of full and differential backups defined by retention-archive, meaning if the last backup taken was a full backup, it will be counted as a differential for the purpose of retention. If set to incr (incremental) will keep archive logs for the number of full, differential, and incremental backups defined by retention-archive. It is recommended that this setting not be changed from the default which will only expire WAL in conjunction with expiring full backups.diffNumber of backups worth of continuous WAL to retain.Note that the WAL segments required to make a backup consistent are always retained until the backup is expired regardless of how this option is configured.
If this value is not set, then the archive to expire will default to the retention-full (or retention-diff) value corresponding to the retention-archive-type if set to full (or diff). This will ensure that WAL is only expired for backups that are already expired.
This option must be set if retention-archive-type is set to incr. If disk space is at a premium, then this setting, in conjunction with retention-archive-type, can be used to aggressively expire WAL segments. However, doing so negates the ability to perform PITR from the backups with expired WAL and is therefore not recommended.2A stanza defines the backup configuration for a specific database cluster. The stanza section must define the database cluster path and host/user if the database cluster is remote. Also, any global configuration sections can be overridden to define stanza-specific settings. exe path on the database host.Required only if the path to is different on the local and database hosts. If not defined, the database host exe path will be set the same as the local exe path.same as local/usr/lib/backrest/bin/pgbackrest database host configuration file.Sets the location of the configuration file on the database host. This is only required if the database host configuration file is in a different location than the local configuration file./etc/pgbackrest_db.confCluster host for operating remotely via SSH.Used for backups where the database cluster host is different from the backup host.db.domain.comCluster host logon user when db-host is set.This user will also own the remote process and will initiate connections to . For this to work correctly the user should be the database cluster owner which is generally postgres, the default.db_ownerCluster data directory.This should be the same as the data_directory setting in postgresql.conf. Even though this value can be read from postgresql.conf or the database cluster it is prudent to set it in case those resources are not available during a restore or offline backup scenario.
The db-path option is tested against the value reported by on every online backup so it should always be current./data/dbCluster port.Port that is running on. This usually does not need to be specified as most database clusters run on the default port.6543Cluster unix socket path.The unix socket directory that was specified when was started. will automatically look in the standard location for your OS so there usually no need to specify this setting unless the socket directory was explicitly modified with the unix_socket_directory setting in postgressql.conf./var/run/postgresqlThe {[project]} Command Reference details all commands and options.Commands are used to execute the various functions. Here the command options are listed exhaustively, that is, each option applicable to a command is listed with that command even if it applies to one or more other commands. This includes all the options that may also configured in pgbackrest.conf.Backup a database cluster. does not have a built-in scheduler so it's best to run it from cron or some other scheduling mechanism.
{[backrest-exe]} --stanza=db --type=full backup
Run a full backup on the db stanza. --type can also be set to incr or diff for incremental or differential backups. However, if no full backup exists then a full backup will be forced even if incr or diff is requested.Push a WAL segment to the archive.The WAL segment may be pushed immediately to the archive or stored locally depending on the value of archive-async
{[backrest-exe]} --stanza=db archive-push %p
Accepts a WAL segment from and archives it in the repository defined by repo-path. %p is how specifies the location of the WAL segment to be archived.Get a WAL segment from the archive.WAL segments are required for restoring a cluster or maintaining a replica.
{[backrest-exe]} --stanza=db archive-get %f %p
Retrieves a WAL segment from the repository. This command is used in recovery.conf to restore a backup, perform PITR, or as an alternative to streaming for keeping a replica up to date. %f is how specifies the WAL segment it needs and %p is the location where it should be copied.Check the configuration.The check command validates that and the archive_command setting are configured correctly for archiving and backups. It detects misconfigurations, particularly in archiving, that result in incomplete backups because required WAL segments did not reach the archive. The command can be run on the database or the backup host.
Note that pg_create_restore_point('pgBackRest Archive Check') and pg_switch_xlog() are called to force to archive a WAL segment. Restore points are only supported in >= 9.1 so for older versions the check command may fail if there has been no write activity since the last log rotation.
{[backrest-exe]} --stanza=db check
Expire backups that exceed retention. does backup rotation but is not concerned with when the backups were created. If two full backups are configured for retention, will keep two full backups no matter whether they occur two hours or two weeks apart.
{[backrest-exe]} --stanza=db expire
Expire (rotate) any backups that exceed the defined retention. Expiration is run automatically after every successful backup, so there is no need to run this command separately unless you have reduced retention, usually to free up some space.Restore a database cluster.This command is generally run manually, but there are instances where it might be automated.
{[backrest-exe]} --stanza=db --type=name --target=release restore
Restores the latest database cluster backup and then recovers to the release restore point.Retrieve information about backups.The info command operates on a single stanza or all stanzas. Text output is the default and gives a human-readable summary of backups for the stanza(s) requested. This format is subject to change with any release.
For machine-readable output use --output=json. The JSON output contains far more information than the text output, however this feature is currently experimental so the format may change between versions.
{[backrest-exe]} --stanza=db --output=json info
Get information about backups in the db stanza.
{[backrest-exe]} --output=json info
Get information about backups for all stanzas in the repository.Get help.Three levels of help are provided. If no command is specified then general help will be displayed. If a command is specified then a full description of the command will be displayed along with a list of valid options. If an option is specified in addition to a command then the a full description of the option as it applies to the command will be displayed.
{[backrest-exe]} help backup
Get help for the backup command.
{[backrest-exe]} help backup force
Get help for the force option of the backup command.Allow processes to run.If the processes were previously stopped using the stop command then they can be started again using the start command. Note that this will not immediately start up any processes but they are allowed to run.
{[backrest-exe]} --stanza=main start
Allows processes to run for the main stanza.Stop processes from running.Does not allow any new processes to run. By default running processes will be allowed to complete successfully. Use the --force option to terminate running processes.
processes will return an error if they are run after the stop command completes.
{[backrest-exe]} stop
Stop new processes for all stanzas but allow any current process to complete.Get version.Displays installed version.
{[backrest-exe]} version
Get version.Create the required stanza data.Must be run during installation on the host where the repository is located. The check command will also be invoked if the database version is greater than or equal to 9.1.
{[backrest-exe]} --stanza=db stanza-create
Create the required data for the db stanza.