Configuration¶
There are two types of configuration files in Barman:
global/generalconfiguration
serverconfiguration
The main configuration file (set to /etc/barman.conf by default)
contains general options such as main directory, system user, log file,
and so on.
Server configuration files, one for each server to be backed up by
Barman, are located in the /etc/barman.d directory and must have a
.conf suffix.
Important
: For historical reasons, you can still have one single configuration file containing both global and server options. However, for maintenance reasons, this approach is deprecated.
Configuration files in Barman follow the INI format.
Configuration files accept distinct types of parameters:
string
enum
integer
boolean,
on/true/1are accepted as well areoff/false/0.
None of them requires to be quoted.
NOTE*: some
enumallowsoffbut notfalse.
Options scope¶
Every configuration option has a scope:
global
server
global/server: server options that can be generally set at global level
Global options are allowed in the general section, which is identified
in the INI file by the [barman] label:
[barman]
; ... global and global/server options go here
Server options can only be specified in a server section, which is
identified by a line in the configuration file, in square brackets
([ and ] ). The server section represents the ID of that server
in Barman. The following example specifies a section for the server
named pg :
[pg]
; Configuration options for the
; server named pg go here
There are two reserved words that cannot be used as server names in Barman:
barman: identifier of the global sectionall: a handy shortcut that allows you to execute some commands on every server managed by Barman in sequence
Barman implements the conventionoverconfiguration design paradigm, which attempts to reduce the number of options that you are required to configure without losing flexibility. Therefore, some server options can be defined at global level and overridden at server level, allowing users to specify a generic behavior and refine it for one or more servers. These options have a global/server scope.
For a list of all the available configurations and their scope, please refer to section 5 of the ‘man’ page .
man 5 barman
Examples of configuration¶
The following is a basic example of main configuration file:
[barman]
barman_user = barman
configuration_files_directory = /etc/barman.d
barman_home = /var/lib/barman
log_file = /var/log/barman/barman.log
log_level = INFO
compression = gzip
The example below, on the other hand, is a server configuration file that uses streaming backup:
[streaming-pg]
description = "Example of PostgreSQL Database (Streaming-Only)"
conninfo = host=pg user=barman dbname=postgres
streaming_conninfo = host=pg user=streaming_barman
backup_method = postgres
streaming_archiver = on
slot_name = barman
The following code shows a basic example of traditional backup using
rsync /SSH:
[ssh-pg]
description = "Example of PostgreSQL Database (via Ssh)"
ssh_command = ssh postgres@pg
conninfo = host=pg user=barman dbname=postgres
backup_method = rsync
parallel_jobs = 1
reuse_backup = link
archiver = on
For more detailed information, please refer to the distributed
barman.conf file, as well as the ssh-server.conf-template and
streaming-server.conf-template template files.