参考文档:http://docs.pgbarman.org/release/2.5/barman.5.html
全局配置文件
- 位置:/etc/barman.conf
- 包含常规选项,如主目录,系统用户,日志文件等。
服务配置文件
- 位置:/etc/barman.d目录中,并且必须具有.conf后缀。
- Barman备份的每个数据库服务器一个文件
属性
属性 | 位置 | 说明 |
---|---|---|
active | 服务器 | 默认true,false时只能用于诊断该服务器,无法执行备份等命令 |
archiver | 全局/服务 | 默认true,指定是否启用归档日志备份 |
backup_directory | 服务 | 服务备份存放位置 |
backup_method | 全局/服务 | 默认rsync,使用rsync备份;配置为postgres将使用pg_basebackup备份 |
BANDWIDTH_LIMIT | 全局/服务 | 执行最大传输速度,单位KB/s,默认为0(无限制) |
basebackup_retry_sleep | 全局/服务 | 基本备份的重试等待秒数,默认为30 |
basebackup_retry_times | 全局/服务 | 基本备份的重试次数,默认为0 |
compression | 全局/服务 | 指定WAL压缩算法包括gzip、bzip2、pigz、pygzip、pybzip2 |
conninfo | 服务 | Barman连接到数据库的连接字符串 |
last_backup_maximum_age | 全局/服务 | 最大保留备份周期,语法为“i(DAYS |
minimum_redundancy | 全局/服务 | 最小保留备份数 |
recovery_options | 全局/服务 | 恢复操作选型,只支持get-wal,默认为空。 |
retention_policy | 全局/服务 | 保留定期备份和存档日志的策略。如果留空,则不会强制执行保留策略。 “REDUNDANCY i”表示强制保留i个备份;支持保留指定周期,如“RECOVERY WINDOW OF i DAYS”、“RECOVERY WINDOW OF i WEEKS”、“RECOVERY WINDOW OF i MONTHS” |
reuse_backup | 全局/服务 | 默认“off”,关闭;“copy”:重用最新的可用备份,并拷贝未变更文件,只复制变更文件以减少备份时间;“link”:重用最新的可用备份,未变更文件使用hard link(需系统支持),只复制变更文件以减少备份时间和空间 |
slot_name | 全局/服务 | 但streaming_archiver为on时,receive-wal命令使用的复制槽,PostgreSQL 9.4及以上版本可用 |
ssh_command | 服务 | Barman SSH登录到Postgres服务器命令 |
streaming_archiver | 全局/服务 | 配置是否用WAL Streaming接收日志,默认为false。为on时,将使用path_prefix路径下的pg_receivewal/pg_receivexlog进行流复制。 |
streaming_conninfo | 服务 | 通过流复制协议连接到Postgres服务器的连接字符串 |
事件
Barman执行操作前后执行的Hook脚本
详见http://docs.pgbarman.org/release/2.5/barman.5.html
流复制示例
; [数据库命名],无需数据库实际名称
[pg1]
; 描述,供阅读使用
description = "Example of PostgreSQL Database (Streaming-Only)"
; 备份目录
backup_directory = /home/backup/192.168.220.133
; Postgres连接字符串(必填)
conninfo = host=pg user=barman dbname=postgres
; PostgreSQL 流复制连接字符串
; pg_basebackup备份和pg_receivexlog流复制wal时使用
; 注意: 用户streaming_barman是一个具备REPLICATION权限的普通用户
streaming_conninfo = host=pg user=streaming_barman
; 备份设置 (通过pg_basebackup实现)
backup_method = postgres
;streaming_backup_name = barman_streaming_backup
; WAL streaming设置 (通过pg_receivexlog实现)
streaming_archiver = on
slot_name = barman
;streaming_archiver_name = barman_receive_wal
;streaming_archiver_batch_size = 50
; PATH setting for this server
;path_prefix = "/usr/pgsql-9.6/bin"