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

More work on docs.

This commit is contained in:
David Steele 2014-09-14 11:38:49 -04:00
parent 8964ba4502
commit 2dc90edb07

View File

@ -1,14 +1,16 @@
# pg_backrest installation
## parameters
## configuration
BackRest takes some command-line parameters, but depends on a configuration file for most of the settings. The default location for the configuration file is /etc/pg_backrest.conf.
### configuration examples
### configuration sections
Each section defines important aspects of the backup.
Each section defines important aspects of the backup. All configuration sections below should be prefixed with "global:" as demonstrated in the configuration samples.
#### command section
@ -54,7 +56,7 @@ The log section defines logging-related settings. The following log levels are
- `debug `- Log debug, info, warnings, and errors
- `trace `- Log trace (very verbose debugging), debug, info, warnings, and errors
##### level-file key
##### level-file
__default__: info
@ -62,7 +64,7 @@ Sets file log level.
_Example_: level-file=warn
##### level-console key
##### level-console
Sets console log level.
@ -73,7 +75,7 @@ _example_: level-file=info
The backup section defines settings related to backup and archiving.
##### host key
##### host
__Required__: N (but must be set if user is defined)
@ -81,7 +83,7 @@ Sets the backup host.
_Example_: host=backup.mydomain.com
##### user key
##### user
__Required__: N (but must be set if host is defined)
@ -89,7 +91,7 @@ Sets user account on the backup host.
_Example_: user=backrest
##### path key
##### path
__Required__: Y
@ -97,7 +99,7 @@ Path where backups are stored on the local or remote host.
_Example_: path=/backup/backrest
##### compress key
##### compress
__Default__: Y
@ -105,7 +107,7 @@ Enable gzip compression. Files stored in the backup are compatible with command
_Example_: compress=n
##### checksum key
##### checksum
__Default__: Y
@ -113,7 +115,14 @@ Enable SHA-1 checksums. Backup checksums are stored in backup.manifest while ar
_Example_: checksum=n
##### hardlink key
##### start_fast
Forces an immediate checkpoint (by passing true to the fast parameter of pg_start_backup()) so the backup begins immediately.
_default_: n
_example_: hardlink=y
##### hardlink
__Default__: N
@ -122,39 +131,122 @@ backup is a full backup. Be care though, because modifying files that are hard-
_Example_: hardlink=y
##### thread_max key
##### thread-max
__default__: 1
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 care though, because modifying files that are hard-linked can affect all the backups in the set.
Defines the number of threads to use for backup. Each thread will perform compression and transfer to make the backup run faster, but don't set `thread-max` so high that it impacts database performance.
_Example_: hardlink=y
_Example_: thread-max=4
##### thread-timeout
Maximum amount of time that a backup thread should run. This limits the amount of time that a thread might be stuck due to unforeseen issues during the backup.
```
CONFIG_SECTION_COMMAND => "command",
CONFIG_SECTION_COMMAND_OPTION => "command:option",
CONFIG_SECTION_LOG => "log",
CONFIG_SECTION_BACKUP => "backup",
CONFIG_SECTION_ARCHIVE => "archive",
CONFIG_SECTION_RETENTION => "retention",
CONFIG_SECTION_STANZA => "stanza",
_default_: <none>
_example_: thread-max=4
CONFIG_KEY_USER => "user",
CONFIG_KEY_HOST => "host",
CONFIG_KEY_PATH => "path",
##### archive-required
CONFIG_KEY_THREAD_MAX => "thread-max",
CONFIG_KEY_THREAD_TIMEOUT => "thread-timeout",
CONFIG_KEY_ARCHIVE_REQUIRED => "archive-required",
CONFIG_KEY_ARCHIVE_MAX_MB => "archive-max-mb",
CONFIG_KEY_START_FAST => "start_fast",
CONFIG_KEY_COMPRESS_ASYNC => "compress-async",
```
Are archive logs required to to complete the backup? It's a good idea to leave this as the default unless you are using another
method for archiving.
### configuration examples
_default_: y
_example_: archive-required=n
#### archive section
The archive 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.
##### path
Path where archive logs are stored before being asynchronously transferred to the backup. Make sure this is not the same path as the backup is using if the backup is local.
_required_: y
_example_: path=/backup/archive
##### compress-async
When set then archive logs are not compressed immediately, but are instead compressed when copied to the backup host. This means that more space will be used on local storage, but the initial archive process will complete more quickly allowing greater throughput from Postgres.
_default_: n
_example_: compress-async=y
##### archive-max-mb
Limits the amount of archive log that will be written locally. After the limit is reached, the following will happen:
1. BackRest will notify Postgres that the archive was succesfully backed up, then DROP IT.
2. An error will be logged to the console and also to the Postgres log.
3. A stop file will be written in the lock directory and no more archive files will be backed up until it is removed.
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.
The purpose of this feature is to prevent the log volume from filling up at which point Postgres will stop all operation. Better to lose the backup than have the database go down completely.
To start normal archiving again you'll need to remove the stop file which will be located at `${archive-path}/lock/${stanza}-archive.stop` where `${archive-path}` is the path set in the archive section, and ${stanza} is the backup stanza.
_required_: n
_example_: archive-max-mb=1024
#### retention section
The rentention 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 full-retention 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 rentention + 1 backups.
##### full-retention
Number of full backups to keep. When a full backup expires, all differential and incremental backups associated with the full backup will also expire. When not defined then all full backups will be kept.
_required_: n
_example_: full-retention=2
##### differential-retention
Number of differential backups to keep. 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.
_required_: n
_example_: differential-retention=3
##### archive-retention-type
Type of backup to use for archive retention (full or differential). If set to full, then BackRest will keep archive logs for the number of full backups defined by `archive-retention`. If set to differential, then BackRest will keep archive logs for the number of differential backups defined by `archive-retention`.
If not defined then archive logs will be kept indefinitely. In general it is not useful to keep archive logs that are older than the oldest backup, but there may be reasons for doing so.
_required_: n
_example_: archive-retention-type=full
##### archive-retention
Number of backups worth of archive log to keep. If not defined, then `full-retention` will be used when `archive-retention-type=full` and `differential-retention` will be used when `archive-retention-type=differential`.
_required_: n
_example_: archive-retention=2
### stanza sections
A stanza defines a backup for a specific database. The stanza section must define the base database path and host/user if the database is remote. Also, any global configuration sections can be overridden to define stanza-specific settings.
##### host
Sets the database host.
_required_: n (but must be set if user is defined)
_example_: host=db.mydomain.com
##### user
Sets user account on the db host.
_required_: n (but must be set if host is defined)
_example_: user=postgres
##### path
Path to the db data directory (data_directory setting in postgresql.conf).
_required_: y
_example_: path=/var/postgresql/data
## sample ubuntu 12.04 install
@ -182,6 +274,6 @@ sudo apt-get update
For unit tests:
create backrest user
setup trusted ssh between test user account and backrest
create backrest_dev user
setup trusted ssh between test user account and backrest_dev
backrest user and test user must be in the same group