pgBackRest(1) Reliable PostgreSQL Backup & Restore

SYNOPSIS

pgbackrest [options] [command]

DESCRIPTION

pgBackRest aims to be a simple, reliable backup and restore system that can seamlessly scale up to the largest databases and workloads.

Instead of relying on traditional backup tools like tar and rsync, pgBackRest implements all backup features internally and uses a custom protocol for communicating with remote systems. Removing reliance on tar and rsync allows for better solutions to database-specific backup challenges. The custom remote protocol allows for more flexibility and limits the types of connections that are required to perform a backup which increases security.

COMMANDS

archive-get
Get a WAL segment from the archive.
archive-push
Push a WAL segment to the archive.
backup
Backup a database cluster.
check
Check the configuration.
expire
Expire backups that exceed retention.
help
Get help.
info
Retrieve information about backups.
restore
Restore a database cluster.
start
Allow pgBackRest processes to run.
stop
Stop pgBackRest processes from running.
version
Get version.

OPTIONS

Archive Options:
--archive-async
Archive WAL segments asynchronously. [default=n]
--archive-max-mb
Limit size of the local asynchronous archive queue when archive-async=y.

Backup Options:

--archive-check
Check that WAL segments are present in the archive before backup completes. [default=y]
--archive-copy
Copy WAL segments needed for consistency to the backup. [default=n]
--backup-host
Backup host when operating remotely via SSH.
--backup-user
Backup host user when backup-host is set. [default=backrest]
--force
Force an offline backup. [default=n]
--hardlink
Hardlink files between backups. [default=n]
--manifest-save-threshold
Manifest save threshold during backup. [default=1073741824]
--resume
Allow resume of failed backup. [default=y]
--start-fast
Force a checkpoint to start backup quickly. [default=n]
--stop-auto
Stop prior failed backup on new backup. [default=n]
--type
Backup type. [default=incr]

Command Options:

--cmd-remote
pgBackRest exe path on the remote host. [default=/build/pgbackrest-1.03/doc/doc.pl]

Expire Options:

--retention-archive
Number of backups worth of WAL to retain.
--retention-archive-type
Backup type for WAL retention. [default=full]
--retention-diff
Number of differential backups to retain.
--retention-full
Number of full backups to retain.

General Options:

--archive-timeout
Archive timeout. [default=60]
--buffer-size
Buffer size for file operations. [default=4194304]
--compress
Use gzip file compression. [default=y]
--compress-level
Compression level for stored files. [default=6]
--compress-level-network
Compression level for network transfer when compress=n. [default=3]
--config
pgBackRest configuration file. [default=/etc/pgbackrest.conf]
--config-remote
pgBackRest remote configuration file. [default=/etc/pgbackrest.conf]
--db-timeout
Database query timeout. [default=1800]
--lock-path
Path where lock files are stored. [default=/tmp/pgbackrest]
--log-path
Path where log files are stored. [default=/var/log/pgbackrest]
--neutral-umask
Use a neutral umask. [default=y]
--online
Perform an online backup. [default=y]
--protocol-timeout
Protocol timeout. [default=1830]
--repo-path
Repository path where WAL segments and backups stored. [default=/var/lib/pgbackrest]
--spool-path
Path where WAL segments are spooled during async archiving. [default=/var/spool/pgbackrest]
--stanza
Command stanza.
--thread-max
Max threads to use in process. [default=1]
--thread-timeout
Max time a thread can run.

Info Options:

--output
Output format. [default=text]

Log Options:

--log-level-console
Level for console logging. [default=warn]
--log-level-file
Level for file logging. [default=info]

Restore Options:

--db-include
Restore only specified databases.
--delta
Restore using delta. [default=n]
--force
Force a restore. [default=n]
--link-all
Restore all symlinks. [default=n]
--link-map
Modify the destination of a symlink.
--lock
Create a lock so restores on a stanza cannot run simultaneously. [default=y]
--recovery-option
Set an option in recovery.conf.
--set
Backup set to restore. [default=latest]
--tablespace-map
Restore a tablespace into the specified directory.
--tablespace-map-all
Restore all tablespaces into the specified directory.
--target
Recovery target.
--target-action
Action to take when recovery target is reached. [default=pause]
--target-exclusive
Stop just before the recovery target is reached. [default=n]
--target-timeline
Recover along a timeline.
--type
Recovery type. [default=default]

Stanza Options:

--db-host
Cluster host for operating remotely via SSH.
--db-path
Cluster data directory.
--db-port
Cluster port. [default=5432]
--db-socket-path
Cluster unix socket path.
--db-user
Cluster host logon user when db-host is set. [default=postgres]

Stop Options:

--force
Force all pgBackRest processes to stop. [default=n]

FILES

/etc/pgbackrest.conf /var/lib/pgbackrest /var/log/pgbackrest /var/spool/pgbackrest /tmp/pgbackrest

EXAMPLES

  • Create a backup of the PostgreSQL `main` cluster:

    $ pgbackrest --stanza=main backup
    The `main` cluster should be configured in `/etc/pgbackrest.conf`
  • Show all available backups:

    $ pgbackrest info
  • Show all available backups for a specific cluster:

    $ pgbackrest --stanza=main info
  • Show backup specific options:

    $ pgbackrest help backup