barman configuration
The configuration file for barman is divided into two.
• One is the global-level: Some parameters related to the global can be configured in this file, the path is in~/.barman.conf
• The other one is for the node. Node-related personalized parameters can be configured in this file, the path is in the global configuration parameters directory.
Plan the directory used by barman on the host where barman is located. The example assumes that the backup data storage mount point is/backup.
Create the relevant directories
mkdir -p /backup/antdb/barman/{bin,conf,log,data}
• conf to store the configuration files for each backup node
• data for the backup data
• log for the backup logs
• bin for the scripts used to restore the backup
Global configuration file
The detailed parameters of the configuration file can be found in the documentationadb-barma-master/doc/barman.conf in the source code directory.
vi ~/.barman.conf
[barman]
barman_user = antdb
configuration_files_directory = /backup/antdb/barman/conf/
barman_home = /backup/antdb/barman/data/
log_file = /backup/antdb/barman/log/barman.log
compression = gzip
parallel_jobs =3
minimum_redundancy = 1
retention_policy = RECOVERY WINDOW OF 1 WEEKS
reuse_backup = link
The following parameters need to be modified as appropriate.
• Barman_user: The user who runs the barman program
• configuration_files_directory: The directory where the configuration files of the node are stored
• barman_home: The directory where the backup data of the node is stored
• log_file: The main log file of the barman program.
• minimum_redundancy: Minimum number of backups to keep
• retention_policy: Retention policy for backup data
Configuration file for backing up nodes
Usually, it is necessary to back up the coordinator master, gtmcoord master and datanode maste nodes in the cluster, and the example of configuration file is as follows:
[antdb@antdb06 conf]$ cat datanode_225m.conf
[datanode_225m]
description = "datanode master datanode_225m"
ssh_command = ssh antdb@134.78.9.256 -q
conninfo = host=134.78.9.256 port=24330 user=antdb dbname=postgres
backup_method = rsync
backup_options = exclusive_backup
parallel_jobs = 3
archiver = on
archiver_batch_size = 50
It is recommended that the configuration file's文件名, the [] identification in the file content, and the nodename in adbmgr are kept consistent for easy identification.
• If you use the cluster version, because there are many nodes, scripts are provided later in this section to generate the configuration files of the masternodes in bulk.
• If you use the standalone version, you can directly edit the node configuration files.
• With the same parameters, the node configuration will override the global configuration.
Check the node configuration
After checking the configuration files of the nodes by barman check nodename, a folder named after the node name is produced in the data directory of barman:
[antdb@kpantdb06 data]$ barman check datanode_225m
Server datanode_225m:
PostgreSQL: OK
is_superuser: OK
wal_level: OK
directories: OK
retention policy settings: OK
backup maximum age: OK (no last_backup_maximum_age provided)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)
ssh: OK (PostgreSQL server)
not in recovery: OK
archive_mode: OK
archive_command: OK
continuous archiving: OK
archiver errors: OK
[antdb@kpantdb06 data]$ ll datanode_225m
total 192
drwxrwxr-x 2 antdb antdb 10 Dec 24 21:14 base
drwxrwxr-x 2 antdb antdb 10 Dec 24 21:14 errors
drwxrwxr-x 2 antdb antdb 135168 Dec 25 10:41 incoming
drwxrwxr-x 2 antdb antdb 10 Dec 24 21:14 streaming
drwxrwxr-x 3 antdb antdb 57 Dec 24 21:24 wals
[antdb@kpantdb06 data]$
Cluster versions with more nodes can perform a check of all nodes by barman check all.