pgbackrest(1) | pgBackRest Command Reference | pgbackrest(1) |
NAME¶
pgBackRest - Reliable PostgreSQL Backup & Restore
SYNOPSIS¶
pgbackrest [options] [command]
DESCRIPTION¶
pgBackRest aims to be a reliable, easy-to-use 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¶
- annotate
- Add or modify backup annotation.
- 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.
- repo-get
- Get a file from a repository.
- repo-ls
- List files in a repository.
- restore
- Restore a database cluster.
- server
- pgBackRest server.
- server-ping
- Ping pgBackRest server.
- 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.
- verify
- Verify contents of the repository.
- version
- Get version.
OPTIONS¶
Annotate Options:
- --set
- Backup set to annotate.
Archive Options:
- --archive-async
- Push/get WAL segments asynchronously. [default=n]
- --archive-get-queue-max
- Maximum size of the pgBackRest archive-get queue. [default=128MiB]
- --archive-header-check
- Check PostgreSQL version/id in WAL headers. [default=y]
- --archive-missing-retry
- Retry missing WAL segment [default=y]
- --archive-push-queue-max
- Maximum size of the PostgreSQL archive queue.
- --archive-timeout
- Archive timeout. [default=60]
Backup Options:
- --annotation
- Annotate backup with user-defined key/value pairs.
- --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]
- --archive-mode-check
- Check the PostgreSQL archive_mode setting. [default=y]
- --backup-standby
- Backup from the standby cluster. [default=n]
- --checksum-page
- Validate data page checksums.
- --exclude
- Exclude paths/files from the backup.
- --expire-auto
- Automatically run the expire command after a successful backup. [default=y]
- --force
- Force an offline backup. [default=n]
- --manifest-save-threshold
- Manifest save threshold during backup. [default=1GiB]
- --online
- Perform an online backup. [default=y]
- --page-header-check
- Check PostgreSQL page headers. [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]
Expire Options:
- --set
- Backup set to expire.
General Options:
- --buffer-size
- Buffer size for I/O operations. [default=1MiB]
- --cmd
- pgBackRest command.
- --cmd-ssh
- SSH client command. [default=ssh]
- --compress
- Use file compression. [default=y]
- --compress-level
- File compression level.
- --compress-level-network
- Network compression level. [default=3]
- --compress-type
- File compression type. [default=gz]
- --config
- pgBackRest configuration file. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_FILE]
- --config-include-path
- Path to additional pgBackRest configuration files. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_INCLUDE_PATH]
- --config-path
- Base path of pgBackRest configuration files. [default=CFGOPTDEF_CONFIG_PATH]
- --db-timeout
- Database query timeout. [default=1800]
- --delta
- Restore or backup using checksums. [default=n]
- --dry-run
- Execute a dry-run for the command. [default=n]
- --io-timeout
- I/O timeout. [default=60]
- --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]
- --raw
- Do not transform data. [default=n]
- --sck-keep-alive
- Keep-alive enable. [default=y]
- --spool-path
- Path where transient data is stored. [default=/var/spool/pgbackrest]
- --stanza
- Defines the stanza.
- --tcp-keep-alive-count
- Keep-alive count.
- --tcp-keep-alive-idle
- Keep-alive idle time.
- --tcp-keep-alive-interval
- Keep-alive interval time.
Info Options:
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]
Repo-get Options:
- --ignore-missing
- Ignore missing source file. [default=n]
Repo-ls Options:
Repository Options:
- --repo
- Set repository.
- --repo-azure-account
- Azure repository account.
- --repo-azure-container
- Azure repository container.
- --repo-azure-endpoint
- Azure repository endpoint. [default=blob.core.windows.net]
- --repo-azure-key
- Azure repository key.
- --repo-azure-key-type
- Azure repository key type. [default=shared]
- --repo-azure-uri-style
- Azure URI Style. [default=host]
- --repo-block
- Enable block incremental backup. [default=n]
- --repo-bundle
- Bundle files in repository. [default=n]
- --repo-bundle-limit
- Limit for file bundles. [default=2MiB]
- --repo-bundle-size
- Target size for file bundles. [default=20MiB]
- --repo-cipher-pass
- Repository cipher passphrase.
- --repo-cipher-type
- Cipher used to encrypt the repository. [default=none]
- --repo-gcs-bucket
- GCS repository bucket.
- --repo-gcs-endpoint
- GCS repository endpoint. [default=storage.googleapis.com]
- --repo-gcs-key
- GCS repository key.
- --repo-gcs-key-type
- GCS repository key type. [default=service]
- --repo-hardlink
- Hardlink files between backups in the repository. [default=n]
- --repo-host
- Repository host when operating remotely.
- --repo-host-ca-file
- Repository host certificate authority file.
- --repo-host-ca-path
- Repository host certificate authority path.
- --repo-host-cert-file
- Repository host certificate file.
- --repo-host-cmd
- Repository host pgBackRest command.
- --repo-host-config
- pgBackRest repository host configuration file. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_FILE]
- --repo-host-config-include-path
- pgBackRest repository host configuration include path. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_INCLUDE_PATH]
- --repo-host-config-path
- pgBackRest repository host configuration path. [default=CFGOPTDEF_CONFIG_PATH]
- --repo-host-key-file
- Repository host key file.
- --repo-host-port
- Repository host port when repo-host is set.
- --repo-host-type
- Repository host protocol type. [default=ssh]
- --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
- Full backup retention count/time.
- --repo-retention-full-type
- Retention type for full backups. [default=count]
- --repo-retention-history
- Days of backup history manifests to retain.
- --repo-s3-bucket
- S3 repository bucket.
- --repo-s3-endpoint
- S3 repository endpoint.
- --repo-s3-key
- S3 repository access key.
- --repo-s3-key-secret
- S3 repository secret access key.
- --repo-s3-key-type
- S3 repository key type. [default=shared]
- --repo-s3-kms-key-id
- S3 repository KMS key.
- --repo-s3-region
- S3 repository region.
- --repo-s3-role
- S3 repository role.
- --repo-s3-token
- S3 repository security token.
- --repo-s3-uri-style
- S3 URI Style. [default=host]
- --repo-sftp-host
- SFTP repository host.
- --repo-sftp-host-fingerprint
- SFTP repository host fingerprint.
- --repo-sftp-host-key-hash-type
- SFTP repository host key hash type.
- --repo-sftp-host-port
- SFTP repository host port. [default=22]
- --repo-sftp-host-user
- SFTP repository host user.
- --repo-sftp-private-key-file
- SFTP private key file.
- --repo-sftp-private-key-passphrase
- SFTP private key passphrase.
- --repo-sftp-public-key-file
- SFTP public key file.
- --repo-storage-ca-file
- Repository storage CA file.
- --repo-storage-ca-path
- Repository storage CA path.
- --repo-storage-host
- Repository storage host.
- --repo-storage-port
- Repository storage port. [default=443]
- --repo-storage-upload-chunk-size
- Repository storage upload chunk size.
- --repo-storage-verify-tls
- Repository storage certificate verify. [default=y]
- --repo-type
- Type of storage used for the repository. [default=posix]
Restore Options:
- --archive-mode
- Preserve or disable archiving on restored cluster. [default=preserve]
- --db-exclude
- Restore excluding the specified databases.
- --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]
Server Options:
- --tls-server-address
- TLS server address. [default=localhost]
- --tls-server-auth
- TLS server authorized clients.
- --tls-server-ca-file
- TLS server certificate authorities.
- --tls-server-cert-file
- TLS server certificate file.
- --tls-server-key-file
- TLS server key file.
- --tls-server-port
- TLS server port. [default=8432]
Stanza Options:
- --pg-database
- PostgreSQL database. [default=postgres]
- --pg-host
- PostgreSQL host for operating remotely.
- --pg-host-ca-file
- PostgreSQL host certificate authority file.
- --pg-host-ca-path
- PostgreSQL host certificate authority path.
- --pg-host-cert-file
- PostgreSQL host certificate file.
- --pg-host-cmd
- PostgreSQL host pgBackRest command.
- --pg-host-config
- pgBackRest database host configuration file. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_FILE]
- --pg-host-config-include-path
- pgBackRest database host configuration include path. [default=CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_INCLUDE_PATH]
- --pg-host-config-path
- pgBackRest database host configuration path. [default=CFGOPTDEF_CONFIG_PATH]
- --pg-host-key-file
- PostgreSQL host key file.
- --pg-host-port
- PostgreSQL host port when pg-host is set.
- --pg-host-type
- PostgreSQL host protocol type. [default=ssh]
- --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.
- --pg-user
- PostgreSQL database user.
Stanza-create Options:
- --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]
Verify Options:
FILES¶
CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_FILE /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 `CFGOPTDEF_CONFIG_PATH "/" PROJECT_CONFIG_FILE`
- •
- 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
02 June 2023 |