Scroll to navigation

pgbackrest(1) pgBackRest Command Reference pgbackrest(1)

NAME

pgBackRest - Reliable PostgreSQL Backup & Restore

SYNOPSIS

pgbackrest [options] [command]

DESCRIPTION

pgBackRest aims to be a simple, reliable backup and restore solution that can seamlessly scale up to the largest databases and workloads by utilizing algorithms that are optimized for database-specific requirements.

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.
stanza-create
Create the required stanza data.
stanza-delete
Delete a stanza.
stanza-upgrade
Upgrade a stanza.
start
Allow pgBackRest processes to run.
stop
Stop pgBackRest processes from running.
version
Get version.

OPTIONS

Archive Options:
--archive-async
Push/get WAL segments asynchronously. [default=n]
--archive-get-queue-max
Maximum size of the pgBackRest archive-get queue. [default=134217728]
--archive-push-queue-max
Maximum size of the PostgreSQL archive queue.
--archive-timeout
Archive timeout. [default=60]

Backup Options:

--archive-check
Check that WAL segments are in the archive before backup completes. [default=y]
--archive-copy
Copy WAL segments needed for consistency to the backup. [default=n]
--backup-standby
Backup from the standby cluster. [default=n]
--checksum-page
Validate data page checksums.
--exclude
Exclude paths/files from the backup.
--force
Force an offline backup. [default=n]
--manifest-save-threshold
Manifest save threshold during backup. [default=1073741824]
--online
Perform an online backup. [default=y]
--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]

General Options:

--buffer-size
Buffer size for file operations. [default=4194304]
--cmd-ssh
Path to ssh client executable. [default=ssh]
--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/pgbackrest.conf]
--config-include-path
Path to additional pgBackRest configuration files. [default=/etc/pgbackrest/conf.d]
--config-path
Base path of pgBackRest configuration files. [default=/etc/pgbackrest]
--db-timeout
Database query timeout. [default=1800]
--delta
Restore or backup using checksums. [default=n]
--lock-path
Path where lock files are stored. [default=/tmp/pgbackrest]
--neutral-umask
Use a neutral umask. [default=y]
--process-max
Max processes to use for compress/transfer. [default=1]
--protocol-timeout
Protocol timeout. [default=1830]
--spool-path
Path where transient data is stored. [default=/var/spool/pgbackrest]
--stanza
Defines the stanza.

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]
--log-level-stderr
Level for stderr logging. [default=warn]
--log-path
Path where log files are stored. [default=/var/log/pgbackrest]
--log-subprocess
Enable logging in subprocesses. [default=n]
--log-timestamp
Enable timestamp in logging. [default=y]

Repository Options:

--repo-cipher-pass
Repository cipher passphrase.
--repo-cipher-type
Cipher used to encrypt the repository. [default=none]
--repo-hardlink
Hardlink files between backups in the repository. [default=n]
--repo-host
Repository host when operating remotely via SSH.
--repo-host-cmd
pgBackRest exe path on the repository host.
--repo-host-config
pgBackRest repository host configuration file. [default=/etc/pgbackrest/pgbackrest.conf]
--repo-host-config-include-path
pgBackRest repository host configuration include path. [default=/etc/pgbackrest/conf.d]
--repo-host-config-path
pgBackRest repository host configuration path. [default=/etc/pgbackrest]
--repo-host-port
Repository host port when repo-host is set.
--repo-host-user
Repository host user when repo-host is set. [default=pgbackrest]
--repo-path
Path where backups and archive are stored. [default=/var/lib/pgbackrest]
--repo-retention-archive
Number of backups worth of continuous WAL to retain.
--repo-retention-archive-type
Backup type for WAL retention. [default=full]
--repo-retention-diff
Number of differential backups to retain.
--repo-retention-full
Number of full backups to retain.
--repo-s3-bucket
S3 repository bucket.
--repo-s3-ca-file
S3 SSL CA File.
--repo-s3-ca-path
S3 SSL CA Path.
--repo-s3-endpoint
S3 repository endpoint.
--repo-s3-host
S3 repository host.
--repo-s3-key
S3 repository access key.
--repo-s3-key-secret
S3 repository secret access key.
--repo-s3-region
S3 repository region.
--repo-s3-token
S3 repository security token.
--repo-s3-verify-ssl
Verify S3 server certificate. [default=y]
--repo-type
Type of storage used for the repository. [default=posix]

Restore Options:

--db-include
Restore only specified databases.
--force
Force a restore. [default=n]
--link-all
Restore all symlinks. [default=n]
--link-map
Modify the destination of a symlink.
--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:

--pg-host
PostgreSQL host for operating remotely via SSH.
--pg-host-cmd
pgBackRest exe path on the PostgreSQL host.
--pg-host-config
pgBackRest database host configuration file. [default=/etc/pgbackrest/pgbackrest.conf]
--pg-host-config-include-path
pgBackRest database host configuration include path. [default=/etc/pgbackrest/conf.d]
--pg-host-config-path
pgBackRest database host configuration path. [default=/etc/pgbackrest]
--pg-host-port
PostgreSQL host port when pg-host is set.
--pg-host-user
PostgreSQL host logon user when pg-host is set. [default=postgres]
--pg-path
PostgreSQL data directory.
--pg-port
PostgreSQL port. [default=5432]
--pg-socket-path
PostgreSQL unix socket path.

Stanza-create Options:

--force
Force stanza creation. [default=n]
--online
Create on an online cluster. [default=y]

Stanza-delete Options:

--force
Force stanza delete. [default=n]

Stanza-upgrade Options:

--online
Update an online cluster. [default=y]

Stop Options:

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

FILES

/etc/pgbackrest/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/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

SEE ALSO

/usr/share/doc/pgbackrest-doc/html/index.html http://www.pgbackrest.org
11 February 2019