我正在尝试配置 Barman 进行备份。当我做
barman check replica
时,我不断得到:
Server replica:
WAL archive: FAILED (please make sure WAL shipping is setup)
PostgreSQL: OK
superuser: OK
wal_level: OK
directories: OK
retention policy settings: OK
backup maximum age: FAILED (interval provided: 1 day, latest backup age: No available backups)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: FAILED (have 0 backups, expected at least 2)
ssh: OK (PostgreSQL server)
not in recovery: FAILED (cannot perform exclusive backup on a standby)
archive_mode: OK
archive_command: OK
continuous archiving: OK
archiver errors: OK
我使用的是 Postgresql 9.6 和 barman 2.1;我不确定问题是什么有人可以帮忙吗? 这是我的酒保服务器配置:
description = "Database backup"
conninfo = host=<db-ip> user=postgres dbname=db
backup_method = rsync
ssh_command = ssh postgres@<db-ip>
archiver = on
barman check
尝试通过断言存档中确实有某些内容来确认存档设置正确。
但是,WAL 段通常只有在填满后才会被归档,如果你的服务器空闲,那么这种情况永远不会发生。
为了解决这个问题,Barman 提供了一个命令来强制进行分段切换,等待完成的 WAL 显示,然后立即将其存档:
barman switch-xlog --force --archive replica
Barman 的
incoming_wals_directory
和 Postgresql.conf 的 archive_command
与详细描述的不匹配这里
另一个原因是之间的不匹配
incoming_wals_directory
archive_command
用于检查的 Bash 实用程序
barman@backup $ barman show-server pg | grep incoming_wals_directory
# output1
# > incoming_wals_directory: /var/lib/barman/pg/incoming
postgres@pg $ cat /etc/postgresql/10/main/postgresql.conf | grep archive_command
# output2
# > archive_command = 'rsync -a %p barman@staging:/var/lib/barman/pg/incoming/%f'
我们在:output1和:output2中必须有相同的路径
如果不匹配,请使其匹配,并且之后不要忘记重新启动 postgres。