barman使用复制槽备份

http://docs.pgbarman.org/release/2.5/

使用复制槽就不用创建公钥及传递公钥了在 barman和pg服务器间

barman使用复制槽备份

复制槽和 rsync 最好不要一起使用,一起使用的话 会导致 incoming里的文件爆满不会自动删除(实践是这样的)

搭建测试环境

vlnx151005101  --PG-Primary

vlnx153005101   --PG-Standby

vlnx151000103  - -barman

1、在barman服务器上创建复制槽

barman receive-wal    --create-slot 备份目标机器

比如

barman receive-wal  --create-slot  vlnx151005101.fxiaokeyun.local

Creating physical replication slot 'barman' on server 'vlnx151005101.fxiaokeyun.local'

Replication slot 'barman' created

槽位名 默认  barman

https://www.postgresql.org/docs/current/warm-standby.html#STREAMING-REPLICATION-SLOTS

也可以在 pg服务器上创建 复制槽

postgres =#SELECT * FROM pg_create_physical_replication_slot('barman');

postgres =#SELECT slot_name,slot_type,active FROM pg_replication_slots;

删除复制槽slot

SELECT * FROM pg_drop_replication_slot('barman');

1.1  在barman 家目录下创建.pgpass 文件,并追加下列内容

barman使用复制槽备份

barman使用复制槽备份

cat /etc/barman.conf

barman使用复制槽备份

 

2、pg服务器  barman服务器访问白名单配置,及槽位

barman使用复制槽备份

pg_hba.conf

#Allow barman to backup PG from backup server remotely

#--------------------------------------------------

# TYPE  DATABASE        USER            ADDRESS                 METHOD

host    all             barman           10.151.0.103/32       md5

host    replication     barman      10.151.0.103/32       md5

/data/pg10/data/postgresql.conf

barman使用复制槽备份

 

3、

barman 服务器上配置 可以只对不同的pg服务器设置相关配置项目

barman使用复制槽备份

barman使用复制槽备份

 

[vlnx153005101.fxiaokeyun.local]

description = vlnx153005101.fxiaokeyun.local

conninfo = host=vlnx153005101.fxiaokeyun.local user=barman dbname=postgres

backup_method = postgres

streaming_conninfo = host=vlnx153005101.fxiaokeyun.local user=barman dbname=postgres

streaming_archiver = on

slot_name = barman

path_prefix = /usr/pgsql-10/bin

 

#基于恢复窗口的保留策略可参考:https://blog.csdn.net/leshami/article/details/15498809

#retention_policy = RECOVERY WINDOW OF 1 WEEKS