Backup and recovery manager for postgresql
The system-level Barman configuration file is located at
/etc/barman.conf
or
/etc/barman/barman.conf
and is overridden on a per-user level by
$HOME/.barman.conf
The Barman configuration file is a plain ini file. There is a general section called [barman] and a section [servername] for each server you want to backup. Rows starting with ; are comments.
Barman supports the inclusion of multiple configuration files, through the configuration_files_directory option. Included files must contain only server specifications, not global configurations. If the value of configuration_files_directory is a directory, Barman reads all files with .conf extension that exist in that folder. For example, if you set it to /etc/barman.d, you can specify your PostgreSQL servers placing each section in a separate .conf file inside the /etc/barman.d folder.
active
Ignored. Server.
description
A human readable description of a server. Server.
ssh_command
Command used by Barman to login to the Postgres server via ssh. Server.
conninfo
Connection string used by Barman to connect to the Postgres server. Server.
basebackups_directory
Directory where base backups will be placed. Global/Server.
wals_directory
Directory which contains WAL files. Global/Server.
incoming_wals_directory
Directory where incoming WAL files are archived into. Global/Server.
lock_file
Lock file for a backup in progress. Global/Server.
log_file
Location of Barman\(cqs log file. Global.
log_level
Level of logging (DEBUG, INFO, WARNING, ERROR, CRITICAL). Global.
custom_compression_filter
Compression algorithm applied to WAL files. Global/Server.
custom_decompression_filter
Decompression algorithm applied to compressed WAL files; this must match the compression algorithm. Global/Server.
pre_backup_script
Hook script launched before a base backup. Global/Server.
post_backup_script
Hook script launched after a base backup. Global/Server.
pre_archive_script
Hook script launched before a base backup. Global/Server.
post_archive_script
Hook script launched after a base backup. Global/Server.
minimum_redundancy
Minimum number of backups to be retained. Default 0. Global/Server.
retention_policy
Policy for retention of periodical backups and archive logs. If left empty, retention policies are not enforced. For redundancy based retention policy use "REDUNDANCY i" (where i is an integer > 0 and defines the number of backups to retain). For recovery window retention policy use "RECOVERY WINDOW OF i DAYS" or "RECOVERY WINDOW OF i WEEKS" or "RECOVERY WINDOW OF i MONTHS" where i is a positive integer representing, specifically, the number of days, weeks or months to retain your backups. For more detailed information, refer to the official documentation. Default value is empty. Global/Server.
wal_retention_policy
Policy for retention of archive logs (WAL files). Currently only "MAIN" is available. Global/Server.
retention_policy_mode
Currently only "auto" is implemented. Global/Server.
bandwidth_limit
This option allows you to specify a maximum transfer rate in kilobytes per second. A value of zero specifies no limit (default). Global/Server.
tablespace_bandwidth_limit
This option allows you to specify a maximum transfer rate in kilobytes per second, by specifying a comma separated list of tablespaces (pairs TBNAME:BWLIMIT). A value of zero specifies no limit (default). Global/Server.
immediate_checkpoint
This option allows you to control the way PostgreSQL handles checkpoint at the start of the backup. If set to false (default), Postgres will wait for a checkpoint to happen before allowing the start of the backup. If set to true, an immediate checkpoint is requested. Global/Server.
network_compression
This option allows you to enable data compression for network transfers. If set to false (default), no compression is used. If set to true, compression is enabled, reducing network usage. Global/Server.
backup_options
This option allows you to enable to control the way PostgreSQL handles backups: If set to exclusive_backup (default), barman backup executes backup operations using the standard exclusive backup approach (technically through pg_start_backup/pg_stop_backup). If set to concurrent_backup, Barman requires the pgespresso module to be installed on the PostgreSQL server (this allows to perform backup from a standby server). Global/Server.
last_backup_maximum_age
This option identifies a time frame that must contain the latest backup. If the latest backup is older than the time frame, barman check command will report an error to the user. If empty (default), latest backup is always considered valid. Syntax for this option is: "i (DAYS | WEEKS | MONTHS)" where i is a integer greater than zero, representing the number of days | weeks | months of the time frame. Global/Server.
basebackup_retry_times
Number of retries of data copy during base backup after an error. Positive integer, default 0. Global/Server.
basebackup_retry_sleep
Number of seconds of wait after a failed copy, before retrying Positive integer, default 30. Global/Server.
The script definition is passed to a shell and can return any exit code.
The shell environment will contain the following variables:
BARMAN_CONFIGURATION
configuration file used by barman
BARMAN_ERROR
error message, if any (only for the post phase)
BARMAN_PHASE
pre or post
BARMAN_SERVER
name of the server
Backup scripts specific variables:
BARMAN_BACKUP_DIR
backup destination directory
BARMAN_BACKUP_ID
ID of the backup
BARMAN_PREVIOUS_ID
ID of the previous backup (if present)
BARMAN_STATUS
status of the backup
BARMAN_VERSION
version of Barman
Archive scripts specific variables:
BARMAN_SEGMENT
name of the WAL file
BARMAN_FILE
full path of the WAL file
BARMAN_SIZE
size of the WAL file
BARMAN_TIMESTAMP
WAL file timestamp
BARMAN_COMPRESSION
type of compression used for the WAL file
No check is performed on the exit code of the script. The result will be simply written in the log file.
Example of the configuration file:
[barman] ; Main directory barman_home = /var/lib/barman ; System user barman_user = barman ; Log location log_file = /var/log/barman/barman.log ; Default compression level ;compression = gzip ; 'main' PostgreSQL Server configuration [main] ; Human readable description description = "Main PostgreSQL Database" ; SSH options ssh_command = ssh postgres@pg ; PostgreSQL connection string conninfo = host=pg user=postgres ; Minimum number of required backups (redundancy) minimum_redundancy = 1 ; Retention policy (based on redundancy) retention_policy = REDUNDANCY 2
In alphabetical order:
Gabriele Bartolini <[email protected]> (core team, project leader)
Giuseppe Broccolo <[email protected]> (core team, QA/testing)
Giulio Calacoci <[email protected]> (core team, developer)
Francesco Canovai <[email protected]> (core team, QA/testing)
Marco Nenciarini <[email protected]> (core team, team leader)
Past contributors:
Carlo Ascani
Homepage: http://www.pgbarman.org/
Documentation: http://docs.pgbarman.org/
Barman is the exclusive property of 2ndQuadrant Italia and its code is distributed under GNU General Public License v3.
Copyright © 2011-2014 2ndQuadrant Italia (Devise.IT S.r.l.) - http://www.2ndQuadrant.it/.