1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
pgbackrest/doc/xml/reference.xml

1040 lines
66 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE doc SYSTEM "doc.dtd">
<doc title="{[project]} Command &amp; Configuration Reference">
<!-- CONFIG -->
<config title="{[project]} Configuration Reference">
<description>The {[project]} Configuration Reference details all configuration options.</description>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<text><backrest/> 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 <file>/etc/pgbackrest.conf</file>.</text>
<config-section-list title="Settings">
<!-- CONFIG - LOG -->
<config-section id="log" name="Log">
<text>The <setting>log</setting> section defines logging-related settings.</text>
<!-- CONFIG - LOG SECTION - LOG-LEVEL-FILE KEY -->
<config-key-list>
<config-key id="log-level-file" name="File Log Level">
<summary>Level for file logging.</summary>
<text>The following log levels are supported:
<ul>
<li><id>off</id> - No logging at all (not recommended)</li>
<li><id>error</id> - Log only errors</li>
<li><id>warn</id> - Log warnings and errors</li>
<li><id>info</id> - Log info, warnings, and errors</li>
<li><id>detail</id> - Log detail, info, warnings, and errors</li>
<li><id>debug</id> - Log debug, detail, info, warnings, and errors</li>
<li><id>trace</id> - Log trace (very verbose debugging), debug, info, warnings, and errors</li>
</ul></text>
<example>debug</example>
</config-key>
<!-- CONFIG - LOG SECTION - LOG-LEVEL-CONSOLE KEY -->
<config-key id="log-level-console" name="Console Log Level">
<summary>Level for console logging.</summary>
<text>The following log levels are supported:
<ul>
<li><id>off</id> - No logging at all (not recommended)</li>
<li><id>error</id> - Log only errors</li>
<li><id>warn</id> - Log warnings and errors</li>
<li><id>info</id> - Log info, warnings, and errors</li>
<li><id>detail</id> - Log detail, info, warnings, and errors</li>
<li><id>debug</id> - Log debug, detail, info, warnings, and errors</li>
<li><id>trace</id> - Log trace (very verbose debugging), debug, info, warnings, and errors</li>
</ul></text>
<example>error</example>
</config-key>
<!-- CONFIG - LOG SECTION - LOG-LEVEL-STDERR KEY -->
<config-key id="log-level-stderr" name="Std Error Log Level">
<summary>Level for stderr logging.</summary>
<text>Specifies which log levels must will be output to <id>stderr</id> rather than <id>stdout</id> (specified by <br-option>log-level-console</br-option>). The timestamp and process will not be output to <id>stderr</id>.
The following log levels are supported:
<ul>
<li><id>off</id> - No logging at all (not recommended)</li>
<li><id>error</id> - Log only errors</li>
<li><id>warn</id> - Log warnings and errors</li>
<li><id>info</id> - Log info, warnings, and errors</li>
<li><id>detail</id> - Log detail, info, warnings, and errors</li>
<li><id>debug</id> - Log debug, detail, info, warnings, and errors</li>
<li><id>trace</id> - Log trace (very verbose debugging), debug, info, warnings, and errors</li>
</ul></text>
<example>error</example>
</config-key>
<!-- CONFIG - LOG SECTION - LOG-TIMESTAMP KEY -->
<config-key id="log-timestamp" name="Log Timestamp">
<summary>Enable timestamp in logging.</summary>
<text>Enables the timestamp in console and file logging. This option is disabled in special situations such as generating documentation.</text>
<example>n</example>
</config-key>
</config-key-list>
</config-section>
<!-- CONFIG - GENERAL -->
<config-section id="general" name="General">
<text>The <setting>general</setting> section defines settings that are shared between multiple operations.</text>
<!-- CONFIG - GENERAL SECTION - ARCHIVE-TIMEOUT -->
<config-key-list>
<config-key id="archive-timeout" name="Archive Timeout">
<summary>Archive timeout.</summary>
<text>Set maximum time, in seconds, to wait for WAL segments to reach the archive. The timeout applies to the <cmd>check</cmd> command and to the <cmd>backup</cmd> command when waiting for WAL segments required to make the backup consistent to be archived.</text>
<example>30</example>
</config-key>
<config-key id="buffer-size" name="Buffer Size">
<summary>Buffer size for file operations.</summary>
2016-09-06 15:35:02 +02:00
<text>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.</text>
<allow>16384 - 8388608</allow>
<example>32768</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - CMD-SSH KEY -->
<config-key id="cmd-ssh" name="SSH client command">
<summary>Path to ssh client executable.</summary>
<text>Use a specific SSH client when an alternate is desired or the <file>ssh</file> executable is not in $PATH.</text>
<example>/usr/bin/ssh</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - COMPRESS -->
<config-key id="compress" name="Compress">
<summary>Use gzip file compression.</summary>
<text>Backup files are compatible with command-line gzip tools.</text>
<example>n</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - COMPRESS-LEVEL KEY -->
<config-key id="compress-level" name="Compress Level">
<summary>Compression level for stored files.</summary>
<text>Sets the zlib level to be used for file compression when <setting>compress=y</setting>.</text>
<allow>0-9</allow>
<example>9</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - COMPRESS-LEVEL-NETWORK KEY -->
<config-key id="compress-level-network" name="Network Compress Level">
<summary>Compression level for network transfer when <setting>compress=n</setting>.</summary>
<text>Sets the zlib level to be used for protocol compression when <setting>compress=n</setting> 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 <setting>compress-level-network=0</setting>. When <setting>compress=y</setting> the <setting>compress-level-network</setting> setting is ignored and <setting>compress-level</setting> is used instead so that the file is only compressed once. SSH compression is always disabled.</text>
<allow>0-9</allow>
<example>1</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - CHECKSUM-PAGE KEY -->
<config-key id="checksum-page" name="Page Checksums">
<summary>Validate data page checksums.</summary>
<text>Directs <backrest/> to validate all data page checksums while backing up a cluster. This option will be automatically enabled when the required C library is present and checksums are enabled on the cluster.
Failures in checksum validation will not abort a backup. Rather, warnings will be emitted in the log (and to the console with default settings) and the list of invalid pages will be stored in the backup manifest.</text>
<example>n</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - DB-TIMEOUT KEY -->
<config-key id="db-timeout" name="Database Timeout">
<summary>Database query timeout.</summary>
<text>Sets the timeout, in seconds, for queries against the database. This includes the <code>pg_start_backup()</code> and <code>pg_stop_backup()</code> 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 <setting>startfast=y</setting> and you know that the database cluster will not generate many WAL segments during the backup).</text>
<example>600</example>
</config-key>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<!-- CONFIG - GENERAL SECTION - LOCK-PATH KEY -->
<config-key id="lock-path" name="Lock Path">
<summary>Path where lock files are stored.</summary>
<text>The lock path provides a location for <backrest/> to create lock files to prevent conflicting operations from being run concurrently.</text>
<example>/backup/db/lock</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - LOG-PATH KEY -->
<config-key id="log-path" name="Log Path">
<summary>Path where log files are stored.</summary>
<text>The log path provides a location for <backrest/> to store log files. Note that if <setting>log-level-file=none</setting> then no log path is required.</text>
<example>/backup/db/log</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - NEUTRAL-UMASK -->
<config-key id="neutral-umask" name="Neutral Umask">
<summary>Use a neutral umask.</summary>
<text>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 <setting>neutral-umask=n</setting> in the config file or <setting>--no-neutral-umask</setting> on the command line.</text>
<example>n</example>
</config-key>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<!-- CONFIG - GENERAL SECTION - LOG-PATH KEY -->
<config-key id="spool-path" name="Spool Path">
<summary>Path where WAL segments are spooled during async archiving.</summary>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<text>When asynchronous archiving is enabled <backrest/> 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.
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
The <setting>max-archive-mb</setting> option can be used to limit the amount of WAL that will be spooled locally.</text>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<example>/backup/db/spool</example>
</config-key>
2016-09-06 15:35:02 +02:00
<!-- CONFIG - GENERAL SECTION - PROCESS-MAX -->
<config-key id="process-max" name="Process Maximum">
<summary>Max processes to use for compress/transfer.</summary>
<text>Each process will perform compression and transfer to make the command run faster, but don't set <setting>process-max</setting> so high that it impacts database performance.</text>
<example>4</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - PROTOCOL-TIMEOUT KEY -->
<config-key id="protocol-timeout" name="Protocol Timeout">
<summary>Protocol timeout.</summary>
<text>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 <br-option>protocol-timeout</br-option> option must be greater than the <br-option>db-timeout</br-option> option.</text>
<example>630</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - REPO-LINK KEY -->
<config-key id="repo-link" name="Repository Symlink Creation">
<summary>Create convenience symlinks in repository.</summary>
<text>Creates the convenience link <path>latest</path> 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 <backrest/> functionality will be affected, but certain manual operations on the repository may be less convenient.</text>
<example>n</example>
</config-key>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<!-- CONFIG - GENERAL SECTION - REPO-PATH KEY -->
<config-key id="repo-path" name="Repository Path">
<summary>Repository path where WAL segments and backups stored.</summary>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<text>The repository is where <backrest/> stores backup and archives WAL segments.
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
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.</text>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<example>/backup/db/backrest</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - REPO-SYNC KEY -->
<config-key id="repo-sync" name="Repository Sync">
<summary>Sync directories in repository.</summary>
<text>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.</text>
<example>n</example>
</config-key>
</config-key-list>
</config-section>
<!-- CONFIG - BACKUP -->
<config-section id="backup" name="Backup">
<text>The <setting>backup</setting> section defines settings related to backup.</text>
<config-key-list>
<!-- CONFIG - BACKUP SECTION - ARCHIVE-CHECK -->
<config-key id="archive-check" name="Check Archive">
<summary>Check that WAL segments are present in the archive before backup completes.</summary>
<text>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.</text>
<example>n</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - ARCHIVE-COPY -->
<config-key id="archive-copy" name="Copy Archive">
<summary>Copy WAL segments needed for consistency to the backup.</summary>
<text>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, <postgres/> will ignore them if a <file>recovery.conf</file> file exists and instead use <setting>archive_command</setting> to fetch WAL segments. Specifying <setting>type=none</setting> when restoring will not create <file>recovery.conf</file> and force <postgres/> to use the WAL segments in pg_xlog. This will get the database cluster to a consistent state.</text>
<example>y</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - BACKUP-CMD KEY -->
<config-key id="backup-cmd" name="Backup Host Command">
<summary><backrest/> exe path on the backup host.</summary>
<text>Required only if the path to <exe/> 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.</text>
<default>same as local</default>
<example>/usr/lib/backrest/bin/pgbackrest</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - BACKUP-CONFIG KEY -->
<config-key id="backup-config" name="Backup Host Configuration">
<summary><backrest/> backup host configuration file.</summary>
<text>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.</text>
<example>/etc/pgbackrest_backup.conf</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - BACKUP-HOST KEY -->
<config-key id="backup-host" name="Backup Host">
<summary>Backup host when operating remotely via SSH.</summary>
<text>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.</text>
<example>backup.domain.com</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - BACKUP-USER KEY -->
<config-key id="backup-user" name="Backup User">
<summary>Backup host user when <setting>backup-host</setting> is set.</summary>
<text>Defines the user that will be used for operations on the backup server. Preferably this is not the <id>postgres</id> user but rather some other user like <id>backrest</id>. If <postgres/> runs on the backup server the <id>postgres</id> user can be placed in the <id>backrest</id> group so it has read permissions on the repository without being able to damage the contents accidentally.</text>
<example>backrest</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - BACKUP-STANDBY KEY -->
<config-key id="backup-standby" name="Backup from Standby">
<summary>Backup from the standby cluster.</summary>
<text>Enable backup from standby to reduce load on the master cluster. This option requires that both the <host>master</host> and <host>standby</host> hosts be configured.</text>
<example>y</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - HARDLINK -->
<config-key id="hardlink" name="Hardlink">
<summary>Hardlink files between backups.</summary>
<text>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.</text>
<example>y</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - MANIFEST-SAVE-THRESHOLD -->
<config-key id="manifest-save-threshold" name="Manifest Save Threshold">
<summary>Manifest save threshold during backup.</summary>
<text>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 <setting>manifest-save-threshold</setting>, whichever is greater.</text>
<example>5368709120</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - RESUME -->
<config-key id="resume" name="Resume">
<summary>Allow resume of failed backup.</summary>
<text>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.</text>
<example>n</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - START-FAST -->
<config-key id="start-fast" name="Start Fast">
<summary>Force a checkpoint to start backup quickly.</summary>
<text>Forces a checkpoint (by passing <id>y</id> to the <id>fast</id> parameter of <code>pg_start_backup()</code>) so the backup begins immediately. Otherwise the backup will start after the next regular checkpoint.
This feature only works in <postgres/> &gt;= <id>8.4</id>.</text>
<example>y</example>
</config-key>
<!-- CONFIG - BACKUP SECTION - STOP-AUTO -->
<config-key id="stop-auto" name="Stop Auto">
<summary>Stop prior failed backup on new backup.</summary>
<text>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 <postgres/> >= <id>9.3</id>.
The setting is disabled by default because it assumes that <backrest/> is the only process doing exclusive online backups. It depends on an advisory lock that only <backrest/> sets so it may abort other processes that do exclusive online backups. Note that <cmd>base_backup</cmd> and <cmd>pg_dump</cmd> are safe to use with this setting because they do not call <code>pg_start_backup()</code> so are not exclusive.</text>
<example>y</example>
</config-key>
</config-key-list>
</config-section>
<!-- CONFIG - ARCHIVE -->
<config-section id="archive" name="Archive">
<text>The <setting>archive</setting> 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.</text>
<config-key-list>
<!-- CONFIG - ARCHIVE SECTION - ARCHIVE-ASYNC KEY -->
<config-key id="archive-async" name="Asynchronous Archiving">
<summary>Archive WAL segments asynchronously.</summary>
<text>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 <postgres/> as soon as the WAL segment is copied locally.</text>
<example>y</example>
</config-key>
<!-- CONFIG - ARCHIVE SECTION - ARCHIVE-QUEUE-MAX KEY -->
<config-key id="archive-queue-max" name="Maximum Archive Queue Size">
<summary>Limit size (in bytes) of the <postgres/> archive queue.</summary>
<text>After the limit is reached, the following will happen:
<ol>
<li><backrest/> will notify <postgres/> that the WAL was successfully archived, then <b>DROP IT</b>.</li>
<li>A warning will be output to the Postgres log.</li>
2016-01-16 03:31:29 +02:00
</ol>If this occurs then the archive log stream will be interrupted and PITR will not be possible past that point. A new backup will be required to regain full restore capability.
In asynchronous mode the entire queue will be dropped to prevent spurts of WAL getting through before the queue limit is exceeded again.
The purpose of this feature is to prevent the log volume from filling up at which point Postgres will stop completely. Better to lose the backup than have <postgres/> go down.</text>
<example>1073741824</example>
</config-key>
</config-key-list>
</config-section>
<!-- CONFIG - RESTORE -->
<config-section id="restore" name="Restore">
<text>The <setting>restore</setting> section defines settings used for restoring backups.</text>
<config-key-list>
<!-- CONFIG - RESTORE SECTION - DB-INCLUDE KEY -->
<config-key id="db-include" name="Include Database">
<summary>Restore only specified databases.</summary>
<text>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 <postgres/> to perform recovery. After recovery the databases that were not included will not be accessible but can be removed with the <id>drop database</id> command.
Note that built-in databases (<id>template0</id>, <id>template1</id>, and <id>postgres</id>) are always restored.
The <setting>{[dash]}-db-include</setting> option can be passed multiple times to specify more than one database to include.</text>
<example>db_main</example>
</config-key>
<!-- CONFIG - RESTORE SECTION - LINK-ALL KEY -->
<config-key id="link-all" name="Link All">
<summary>Restore all symlinks.</summary>
<text>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.</text>
<example>y</example>
</config-key>
<!-- CONFIG - RESTORE SECTION - LINK-MAP KEY -->
<config-key id="link-map" name="Link Map">
<summary>Modify the destination of a symlink.</summary>
<text>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.</text>
<example>pg_xlog=/data/xlog</example>
</config-key>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<!-- CONFIG - RESTORE SECTION - RECOVERY-OPTION KEY -->
<config-key id="recovery-option" name="Recovery Option">
<summary>Set an option in <file>recovery.conf</file>.</summary>
<text>See http://www.postgresql.org/docs/X.X/static/recovery-config.html for details on recovery.conf options (replace X.X with your <postgres/> version). This option can be used multiple times.
Note: The <setting>restore_command</setting> option will be automatically generated but can be overridden with this option. Be careful about specifying your own <setting>restore_command</setting> as <backrest/> is designed to handle this for you. Target Recovery options (recovery_target_name, recovery_target_time, etc.) are generated automatically by <backrest/> and should not be set with this option.
Since <backrest/> does not start <postgres/> after writing the <file>recovery.conf</file> file, it is always possible to edit/check <file>recovery.conf</file> before manually restarting.</text>
<example>primary_conninfo=db.mydomain.com</example>
</config-key>
<!-- CONFIG - RESTORE SECTION - TABLESPACE-MAP KEY -->
<config-key id="tablespace-map" name="Tablespace Map">
<summary>Restore a tablespace into the specified directory.</summary>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<text>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 <postgres/> 9.2 tablespace locations are not stored in pg_tablespace so moving tablespaces can be done with impunity. However, moving a tablespace to the <setting>data_directory</setting> 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.</text>
<example>ts_01=/db/ts_01</example>
</config-key>
<!-- CONFIG - RESTORE SECTION - TABLESPACE KEY -->
<config-key id="tablespace-map-all" name="Map All Tablespaces">
<summary>Restore all tablespaces into the specified directory.</summary>
<text>By default tablespaces are restored into their original locations and while this behavior can be modified by with the <setting>tablespace-map</setting> 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.</text>
<example>/data/tablespace</example>
</config-key>
</config-key-list>
</config-section>
<!-- CONFIG - EXPIRE -->
<config-section id="expire" name="Expire">
<text>The <setting>expire</setting> 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.</text>
<!-- CONFIG - RETENTION SECTION - FULL-RETENTION KEY -->
<config-key-list>
<config-key id="retention-full" name="Full Retention">
<summary>Number of full backups to retain.</summary>
<text>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.</text>
<example>2</example>
</config-key>
<!-- CONFIG - RETENTION SECTION - DIFFERENTIAL-RETENTION KEY -->
<config-key id="retention-diff" name="Differential Retention">
<summary>Number of differential backups to retain.</summary>
<text>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.</text>
<example>3</example>
</config-key>
<!-- CONFIG - RETENTION SECTION - ARCHIVE-RETENTION-TYPE KEY -->
<config-key id="retention-archive-type" name="Archive Retention Type">
<summary>Backup type for WAL retention.</summary>
<text>If set to <setting>full</setting> <backrest/> will keep archive logs for the number of full backups defined by <setting>retention-archive</setting>. If set to <setting>diff</setting> (differential) <backrest/> will keep archive logs for the number of full and differential backups defined by <setting>retention-archive</setting>, 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 <setting>incr</setting> (incremental) <backrest/> will keep archive logs for the number of full, differential, and incremental backups defined by <setting>retention-archive</setting>. It is recommended that this setting not be changed from the default which will only expire WAL in conjunction with expiring full backups.</text>
<example>diff</example>
</config-key>
<!-- CONFIG - RETENTION SECTION - ARCHIVE-RETENTION KEY -->
<config-key id="retention-archive" name="Archive Retention">
<summary>Number of backups worth of continuous WAL to retain.</summary>
<text>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 <setting>retention-full</setting> (or <setting>retention-diff</setting>) value corresponding to the <setting>retention-archive-type</setting> if set to <setting>full</setting> (or <setting>diff</setting>). This will ensure that WAL is only expired for backups that are already expired.
This option must be set if <setting>retention-archive-type</setting> is set to <setting>incr</setting>. If disk space is at a premium, then this setting, in conjunction with <setting>retention-archive-type</setting>, 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 <b>not</b> recommended.</text>
<example>2</example>
</config-key>
</config-key-list>
</config-section>
<!-- CONFIG - STANZA -->
<config-section id="stanza" name="Stanza">
<text>A stanza defines the backup configuration for a specific <postgres/> 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.</text>
<config-key-list>
<!-- CONFIG - STANZA SECTION - DB-CMD KEY -->
<config-key id="db-cmd" name="Database Host Command">
<summary><backrest/> exe path on the database host.</summary>
<text>Required only if the path to <exe/> 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.</text>
<default>same as local</default>
<example>/usr/lib/backrest/bin/pgbackrest</example>
</config-key>
<!-- CONFIG - STANZA SECTION - DB_CONFIG KEY -->
<config-key id="db-config" name="Database Host Configuration">
<summary><backrest/> database host configuration file.</summary>
<text>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.</text>
<example>/etc/pgbackrest_db.conf</example>
</config-key>
<!-- CONFIG - STANZA SECTION - DB-HOST KEY -->
<config-key id="db-host" name="Database Host">
<summary>Cluster host for operating remotely via SSH.</summary>
<text>Used for backups where the database cluster host is different from the backup host.</text>
<example>db.domain.com</example>
</config-key>
<!-- CONFIG - STANZA SECTION - DB-USER KEY -->
<config-key id="db-user" name="Database User">
<summary>Cluster host logon user when <setting>db-host</setting> is set.</summary>
<text>This user will also own the remote <backrest/> process and will initiate connections to <postgres/>. For this to work correctly the user should be the <postgres/> database cluster owner which is generally <id>postgres</id>, the default.</text>
<example>db_owner</example>
</config-key>
<!-- CONFIG - STANZA SECTION - DB-PATH KEY -->
<config-key id="db-path" name="Database Path">
<summary>Cluster data directory.</summary>
<text>This should be the same as the <setting>data_directory</setting> setting in <file>postgresql.conf</file>. Even though this value can be read from <file>postgresql.conf</file> 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 <setting>db-path</setting> option is tested against the value reported by <postgres/> on every online backup so it should always be current.</text>
<example>/data/db</example>
</config-key>
<!-- CONFIG - STANZA SECTION - DB-PORT KEY -->
<config-key id="db-port" name="Database Port">
<summary>Cluster port.</summary>
<text>Port that <postgres/> is running on. This usually does not need to be specified as most database clusters run on the default port.</text>
<example>6543</example>
</config-key>
<!-- CONFIG - STANZA SECTION - DB-SOCKET-PATH KEY -->
<config-key id="db-socket-path" name="Database Socket Path">
<summary>Cluster unix socket path.</summary>
<text>The unix socket directory that was specified when <postgres/> was started. <backrest/> 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 <setting>unix_socket_directory</setting> setting in <file>postgressql.conf</file>.</text>
<example>/var/run/postgresql</example>
</config-key>
</config-key-list>
</config-section>
</config-section-list>
</config>
<!-- COMMAND -->
<operation title="{[project]} Command Reference">
<description>The {[project]} Command Reference details all commands and options.</description>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<text>Commands are used to execute the various <backrest/> 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 <file>pgbackrest.conf</file>.</text>
<operation-general title="General Options">
<option-list>
<!-- OPERATION - GENERAL - CONFIG OPTION -->
<option id="config" name="Config">
<summary><backrest/> configuration file.</summary>
<text>Use this option to specify a different configuration file than the default.</text>
New simpler configuration and consistent project/exe/path naming. * The repo-path option now always refers to the repository where backups and archive are stored, whether local or remote, so the repo-remote-path option has been removed. The new spool-path option can be used to define a location for queueing WAL segments when archiving asynchronously. Otherwise, a local repository is no longer required. * Implemented a new config format which should be far simpler to use. See the User Guide and Configuration Reference for details but for a simple configuration all options can now be placed in the stanza section. Options that are shared between stanzas can be placed in the [global] section. More complex configurations can still make use of command sections though this should be a rare use case. * The default configuration filename is now pgbackrest.conf instead of pg_backrest.conf. This was done for consistency with other naming changes but also to prevent old config files from being loaded accidentally. * The default repository name was changed from /var/lib/backup to /var/lib/pgbackrest. * Lock files are now stored in /tmp/pgbackrest by default. These days /run/pgbackrest would be the preferred location but that would require init scripts which are not part of this release. The lock-path option can be used to configure the lock directory. * Log files are now stored in /var/log/pgbackrest by default and no longer have the date appended so they can be managed with logrotate. The log-path option can be used to configure the lock directory. * Executable filename changed from pg_backrest to pgbackrest.
2016-04-14 15:30:54 +02:00
<example>/var/lib/backrest/pgbackrest.conf</example>
</option>
<!-- OPERATION - GENERAL - STANZA OPTION -->
<option id="stanza" name="Stanza">
<summary>Defines a stanza.</summary>
<text>A stanza is the configuration for a <postgres/> database cluster that defines where it is located, how it will be backed up, archiving options, etc. Most db servers will only have one Postgres database cluster and therefore one stanza, whereas backup servers will have a stanza for every database cluster that needs to be backed up.
It is tempting to name the stanza after the primary cluster but a better name describes the databases contained in the cluster. Because the stanza name will be used for the primary and all replicas it is more appropriate to choose a name that describes the actual function of the cluster, such as app or dw, rather than the local cluster name, such as main or prod.</text>
<example>main</example>
</option>
<!-- OPERATION - GENERAL - ONLINE OPTION -->
<option id="online" name="Online">
<summary>Perform an online backup.</summary>
<text>Specifying --no-online prevents <backrest/> from running <code>pg_start_backup()</code> and <code>pg_stop_backup()</code> on the database cluster. In order for this to work <postgres/> should be shut down and <backrest/> will generate an error if it is not.
The purpose of this option is to allow offline backups. The <path>pg_xlog</path> directory is copied as-is and <setting>archive-check</setting> is automatically disabled for the backup.</text>
<example>n</example>
</option>
</option-list>
</operation-general>
<command-list title="Commands">
<!-- OPERATION - BACKUP COMMAND -->
<command id="backup" name="Backup">
<summary>Backup a database cluster.</summary>
<text><backrest/> does not have a built-in scheduler so it's best to run it from cron or some other scheduling mechanism.</text>
<option-list>
<!-- OPERATION - BACKUP COMMAND - TYPE OPTION -->
<option id="type" name="Type">
<summary>Backup type.</summary>
<text>The following backup types are supported:
<ul>
<li><id>full</id> - all database cluster files will be copied and there will be no dependencies on previous backups.</li>
<li><id>incr</id> - incremental from the last successful backup.</li>
<li><id>diff</id> - like an incremental backup but always based on the last full backup.</li>
</ul></text>
<example>full</example>
</option>
<!-- OPERATION - BACKUP COMMAND - FORCE OPTION -->
<option id="force" name="Force">
<summary>Force an offline backup.</summary>
<text>When used with <br-option>--no-start-stop</br-option> a backup will be run even if <backrest/> thinks that <postgres/> is running. <b>This option should be used with extreme care as it will likely result in a bad backup.</b>
There are some scenarios where a backup might still be desirable under these conditions. For example, if a server crashes and the database cluster volume can only be mounted read-only, it would be a good idea to take a backup even if <file>postmaster.pid</file> is present. In this case it would be better to revert to the prior backup and replay WAL, but possibly there is a very important transaction in a WAL segment that did not get archived.</text>
<example>y</example>
</option>
</option-list>
<command-example-list>
<command-example title="Full Backup">
<text><code-block title="">
{[backrest-exe]} --stanza=db --type=full backup
</code-block>
Run a <id>full</id> backup on the <id>db</id> stanza. <br-option>--type</br-option> can also be set to <id>incr</id> or <id>diff</id> for incremental or differential backups. However, if no <id>full</id> backup exists then a <id>full</id> backup will be forced even if <id>incr</id> or <id>diff</id> is requested.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - ARCHIVE-PUSH COMMAND -->
<command id="archive-push" name="Archive Push">
<summary>Push a WAL segment to the archive.</summary>
<text>The WAL segment may be pushed immediately to the archive or stored locally depending on the value of <setting>archive-async</setting></text>
<command-example-list>
<command-example>
<text><code-block title="">
{[backrest-exe]} --stanza=db archive-push %p
</code-block>
Accepts a WAL segment from <postgres/> and archives it in the repository defined by <setting>repo-path</setting>. <id>%p</id> is how <postgres/> specifies the location of the WAL segment to be archived.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - ARCHIVE-GET COMMAND -->
<command id="archive-get" name="Archive Get">
<summary>Get a WAL segment from the archive.</summary>
<text>WAL segments are required for restoring a <postgres/> cluster or maintaining a replica.</text>
<command-example-list>
<command-example>
<text><code-block title="">
{[backrest-exe]} --stanza=db archive-get %f %p
</code-block>
Retrieves a WAL segment from the repository. This command is used in <file>recovery.conf</file> to restore a backup, perform PITR, or as an alternative to streaming for keeping a replica up to date. <id>%f</id> is how <postgres/> specifies the WAL segment it needs and <id>%p</id> is the location where it should be copied.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - CHECK COMMAND -->
<command id="check" name="Check">
<summary>Check the configuration.</summary>
<text>The <cmd>check</cmd> command validates that <backrest/> and the <pg-setting>archive_command</pg-setting> setting are configured correctly for archiving and backups. It detects misconfigurations, particularly in archiving, that result in incomplete backups because required WAL segments did not reach the archive. The command can be run on the database or the backup host. The command may also be run on the standby host, however, since <code>pg_switch_xlog()</code> cannot be performed on the standby, the command will only test the repository configuration.
Note that <code>pg_create_restore_point('pgBackRest Archive Check')</code> and <code>pg_switch_xlog()</code> are called to force <postgres/> to archive a WAL segment. Restore points are only supported in <postgres/> &gt;= 9.1 so for older versions the <cmd>check</cmd> command may fail if there has been no write activity since the last log rotation, therefore it is recommended that activity be generated by the user if there have been no writes since the last xlog switch before running the <cmd>check</cmd> command.</text>
<command-example-list>
<command-example>
<text><code-block title="">
{[backrest-exe]} --stanza=db check
</code-block>
</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - EXPIRE COMMAND -->
<command id="expire" name="Expire">
<summary>Expire backups that exceed retention.</summary>
<text><backrest/> does backup rotation but is not concerned with when the backups were created. If two full backups are configured for retention, <backrest/> will keep two full backups no matter whether they occur two hours or two weeks apart.</text>
<command-example-list>
<command-example>
<text><code-block title="">
{[backrest-exe]} --stanza=db expire
</code-block>
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.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - RESTORE COMMAND -->
<command id="restore" name="Restore">
<summary>Restore a database cluster.</summary>
<text>This command is generally run manually, but there are instances where it might be automated.</text>
<option-list>
<!-- OPERATION - RESTORE COMMAND - SET OPTION -->
<option id="set" name="Set">
<summary>Backup set to restore.</summary>
<text>The backup set to be restored. <id>latest</id> will restore the latest backup, otherwise provide the name of the backup to restore.</text>
<example>20150131-153358F_20150131-153401I</example>
</option>
<!-- OPERATION - RESTORE COMMAND - DELTA OPTION -->
<option id="delta" name="Delta">
<summary>Restore using delta.</summary>
<text>By default the <postgres/> data and tablespace directories are expected to be present but empty. This option performs a delta restore using checksums.</text>
<example>y</example>
</option>
<!-- OPERATION - RESTORE COMMAND - FORCE OPTION -->
<option id="force" name="Force">
<summary>Force a restore.</summary>
<text>By itself this option forces the <postgres/> data and tablespace paths to be completely overwritten. In combination with <br-option>--delta</br-option> a timestamp/size delta will be performed instead of using checksums.</text>
<example>y</example>
</option>
<!-- OPERATION - RESTORE COMMAND - TYPE OPTION -->
<option id="type" name="Type">
<summary>Recovery type.</summary>
<text>The following recovery types are supported:
<ul>
<li><id>default</id> - recover to the end of the archive stream.</li>
<li><id>immediate</id> - recover only until the database becomes consistent. This option is only supported on <postgres/> &gt;= 9.4.</li>
<li><id>name</id> - recover the restore point specified in <br-option>--target</br-option>.</li>
<li><id>xid</id> - recover to the transaction id specified in <br-option>--target</br-option>.</li>
<li><id>time</id> - recover to the time specified in <br-option>--target</br-option>.</li>
<li><id>preserve</id> - preserve the existing <file>recovery.conf</file> file.</li>
<li><id>none</id> - no <file>recovery.conf</file> file is written so <postgres/> will attempt to achieve consistency using WAL segments present in <path>pg_xlog</path>. Provide the required WAL segments or use the <setting>archive-copy</setting> setting to include them with the backup.</li>
</ul></text>
<example>xid</example>
</option>
<!-- OPERATION - RESTORE COMMAND - TARGET OPTION -->
<option id="target" name="Target">
<summary>Recovery target.</summary>
<text>Defines the recovery target when <br-option>--type</br-option> is <id>name</id>, <id>xid</id>, or <id>time</id>.</text>
<example>2015-01-30 14:15:11 EST</example>
</option>
<!-- OPERATION - RESTORE COMMAND - TARGET-EXCLUSIVE OPTION -->
<option id="target-exclusive" name="Target Exclusive">
<summary>Stop just before the recovery target is reached.</summary>
<text>Defines whether recovery to the target would be exclusive (the default is inclusive) and is only valid when <br-option>--type</br-option> is <id>time</id> or <id>xid</id>. For example, using <br-option>--target-exclusive</br-option> would exclude the contents of transaction <id>1007</id> when <br-option>--type=xid</br-option> and <br-option>--target=1007</br-option>. See the <setting>recovery_target_inclusive</setting> option in the <postgres/> docs for more information.</text>
<example>n</example>
</option>
<!-- OPERATION - RESTORE COMMAND - TARGET-RESUME OPTION -->
<option id="target-action" name="Target Action">
<summary>Action to take when recovery target is reached.</summary>
<text>The following actions are supported:
<ul>
<li><id>pause</id> - pause when recovery target is reached.</li>
<li><id>promote</id> - promote and switch timeline when recovery target is reached.</li>
<li><id>shutdown</id> - shutdown server when recovery target is reached.</li>
</ul>This option is only supported on <postgres/> &gt;= 9.5.</text>
<example>promote</example>
</option>
<!-- OPERATION - RESTORE COMMAND - TARGET-TIMELINE OPTION -->
<option id="target-timeline" name="Target Timeline">
<summary>Recover along a timeline.</summary>
<text>See <setting>recovery_target_timeline</setting> in the <postgres/> docs for more information.</text>
<example>3</example>
</option>
</option-list>
<command-example-list>
<command-example title="Restore Latest">
<text><code-block title="">
{[backrest-exe]} --stanza=db --type=name --target=release restore
</code-block>
Restores the latest database cluster backup and then recovers to the <id>release</id> restore point.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - INFO COMMAND -->
<command id="info" name="Info">
<summary>Retrieve information about backups.</summary>
<text>The <cmd>info</cmd> 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 <setting>--output=json</setting>. The JSON output contains far more information than the text output, however <b>this feature is currently experimental so the format may change between versions</b>.</text>
<option-list>
<!-- OPERATION - INFO COMMAND - OUTPUT OPTION -->
<option id="output" name="Output">
<summary>Output format.</summary>
<text>The following output types are supported:
<ul>
<li><id>text</id> - Human-readable summary of backup information.</li>
<li><id>json</id> - Exhaustive machine-readable backup information in JSON format.</li>
</ul></text>
<example>json</example>
</option>
</option-list>
<command-example-list>
<command-example title="Information for a single stanza">
<text><code-block title="">
{[backrest-exe]} --stanza=db --output=json info
</code-block>
Get information about backups in the <id>db</id> stanza.</text>
</command-example>
<command-example title="Information for all stanzas">
<text><code-block title="">
{[backrest-exe]} --output=json info
</code-block>
Get information about backups for all stanzas in the repository.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - HELP COMMAND -->
<command id="help" name="Help">
<summary>Get help.</summary>
<text>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.</text>
<command-example-list>
<command-example title="Help for the backup command">
<text><code-block title="">
{[backrest-exe]} help backup
</code-block>
Get help for the backup command.</text>
</command-example>
<command-example title="Help for backup command, --force option">
<text><code-block title="">
{[backrest-exe]} help backup force
</code-block>
Get help for the force option of the backup command.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - START COMMAND -->
<command id="start" name="Start">
<summary>Allow <backrest/> processes to run.</summary>
<text>If the <backrest/> processes were previously stopped using the <cmd>stop</cmd> command then they can be started again using the <cmd>start</cmd> command. Note that this will not immediately start up any <backrest/> processes but they are allowed to run.</text>
<command-example-list>
<command-example title="Start processes for stanza main">
<text><code-block title="">
{[backrest-exe]} --stanza=main start
</code-block>
Allows <backrest/> processes to run for the <id>main</id> stanza.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - STOP COMMAND -->
<command id="stop" name="Stop">
<summary>Stop <backrest/> processes from running.</summary>
<text>Does not allow any new <backrest/> processes to run. By default running processes will be allowed to complete successfully. Use the <setting>--force</setting> option to terminate running processes.
<backrest/> processes will return an error if they are run after the stop command completes.</text>
<option-list>
<!-- OPERATION - STOP COMMAND - FORCE OPTION -->
<option id="force" name="Force">
<summary>Force all <backrest/> processes to stop.</summary>
<text>This option will send TERM signals to all running <backrest/> processes to effect a graceful but immediate shutdown. Note that this will also shutdown processes that were initiated on another system but have remotes running on the current system. For instance, if a backup was started on the backup server then running <cmd>stop --force</cmd> on the database server will shutdown the backup process on the backup server.</text>
<example>y</example>
</option>
</option-list>
<command-example-list>
<command-example title="Stop processes for all stanzas">
<text><code-block title="">
{[backrest-exe]} stop
</code-block>
Stop new <backrest/> processes for all stanzas but allow any current process to complete.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - VERSION COMMAND -->
<command id="version" name="Version">
<summary>Get version.</summary>
<text>Displays installed <backrest/> version.</text>
<command-example-list>
<command-example title="Get version">
<text><code-block title="">
{[backrest-exe]} version
</code-block>
Get <backrest/> version.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - STANZA-CREATE COMMAND -->
<command id="stanza-create" name="Stanza Create">
<summary>Create the required stanza data.</summary>
<text>The <cmd>stanza-create</cmd> command must be run on the host where the repository is located after the stanza has been configured in <file>pgbackrest.conf</file>.</text>
<option-list>
<!-- OPERATION - STANZA-CREATE COMMAND - FORCE OPTION -->
<option id="force" name="Force">
<summary>Force stanza creation.</summary>
<text>If the required stanza information does not exist in the repository but backups or WAL segments do exist, then this option can be used to force the stanza to be created from the existing data in the repository. This is most likely to be useful after corruption or an incomplete restore of the repository from elsewhere.</text>
<example>n</example>
</option>
</option-list>
<command-example-list>
<command-example title="Create required stanza data">
<text><code-block title="">
{[backrest-exe]} --stanza=db stanza-create
</code-block>
Create the required data for the <id>db</id> stanza.</text>
</command-example>
</command-example-list>
</command>
<!-- OPERATION - STANZA-UPGRADE COMMAND -->
<command id="stanza-upgrade" name="Stanza Upgrade">
<summary>Upgrade a stanza.</summary>
<text>Immediately after upgrading <postgres/> to a newer major version, the <br-option>db-path</br-option> for all <backrest/> configurations must be set to the new database location and the <cmd>stanza-upgrade</cmd> run on the backup host. If the database is offline use the <br-option>--no-online</br-option> option.</text>
<command-example-list>
<command-example title="Upgrade a stanza">
<text><code-block title="">
{[backrest-exe]} --stanza=db stanza-upgrade
</code-block>
Upgrade the <id>db</id> stanza to a new version of <postgres/>.</text>
</command-example>
</command-example-list>
</command>
</command-list>
</operation>
</doc>