Quick StartEdit this page
This section walks you through basic pgBackRest configuration process and how to take a first backup of the database cluster running locally. It also gives a brief introduction of the
The installation procedure must be followed before proceeding to this section.
The default pgBackRest configuration file location is
/etc/pgbackrest/pgbackrest.conf. If it does not exist, then
/etc/pgbackrest.conf is used next.
For more information about configuration parameters, see the appendix section.
The following example configures a
demo stanza to take a backup of a database cluster running on the local host.
For EDB Postgres Advanced Server:
Once pgBackRest is configured, set up the database archiver process:
As changing the
archive_mode parameter requires a service restart, and changing the
archive_command only requires a configuration reload, we recommend enabling
archive_mode with an empty
archive_command (or pointing to /bin/true) when initiating a new database cluster.
Assume the identity of a system user (
enterprisedb) and initiate the pgBackRest repository:
Check the configuration and the archiving process:
When invoking pgBackRest, you can specify any one of the backup type:
- Full backup -
- Copies all database cluster files.
- No dependencies on previous backups.
- Incremental backup -
- Copies only the database cluster files that have changed since the last backup.
- Depends on other backups to restore the incremental backup.
- Differential backup -
- Copies only the database cluster files that have changed since the last full backup.
- Similar to an incremental backup, but always depends on the last full backup.
If there is no full backup to base an incremental or differential backup on, pgBackRest will run in full backup mode instead.
info command to get information about backups.
By default, the
info command provides a human-readable summary of backups for the stanza requested. Without specifying
info command will operate on all stanzas.
restore command to restore a backup. The
--delta option allows to keep the existing database cluster files and only recover as required, where as without the
--delta option all files will be restored. Before running the restore command, stop the database cluster and (unless the
--delta option is used) remove all files from the data directory, and from tablespaces.
Currently, the only way to verify the consistency of a backup is to restore it. We then recommend to try restore backups on a regular basis.
By default, the
restore command will restore the latest backup and apply all of the archived WAL files found in the repository.
To choose the recovery target type for the restore, include the
--type command-line option with one of the following keywords:
default- recover to the end of the archive stream.
immediate- recovery only until the database becomes consistent.
name- recover to the restore point.
xid- recover to the transaction ID.
time- recover to a specific timestamp.
preserve- preserve the existing recovery settings.
none- no recovery settings provided.
--type is set to name, transaction ID (xid), or time, use the
--target option to specify a restore point.
pgBackRest will automatically select the correct backup set to restore if a recovery target time is specified. Otherwise, the latest backup set will be used. To restore a specific backup set, use the
To change the
recovery_target_action PostgreSQL setting, use the restore
pause- pause when recovery target is reached (default).
promote- promote and switch timeline when recovery target is reached.
shutdown- shutdown server when recovery target is reached.