我一直在摸索解决以下错误,但没有取得太大进展:
$ barman switch-wal --force --archive --archive-timeout 180 pg
The WAL file 0000000100000059000000FF has been closed on server 'pg'
Waiting for the WAL file 0000000100000059000000FF from server 'pg' (max: 180 seconds)
ERROR: The WAL file 0000000100000059000000FF has not been received in 180 seconds
我之前在一次性 VPS 上配置了酒保,一切正常。但是当我尝试在我们的最终 EC2 实例上复制它时,我遇到了上面提到的问题。我已经确保了以下内容(即使我不记得在 VPS 上这样做了):
- 来自酒吧的 SSH => pg 正在工作
- 来自 pg => barman 的 SSH 正在工作
- 'pg' 上的所有防火墙规则已被暂时禁用
这里可能是什么问题?
编辑:添加输出barman check pg
Server pg:
2017-12-08 05:56:31,841 [14559] barman.server ERROR: Check 'WAL archive' failed for server 'pg'
WAL archive: FAILED (please make sure WAL shipping is setup)
PostgreSQL: OK
is_superuser: OK
PostgreSQL streaming: OK
wal_level: OK
2017-12-08 05:56:34,174 [14559] barman.server ERROR: Check 'replication slot' failed for server 'pg'
replication slot: FAILED (slot 'pgbackup' not active: is 'receive-wal' running?)
directories: OK
retention policy settings: OK
2017-12-08 05:56:34,175 [14559] barman.server ERROR: Check 'backup maximum age' failed for server 'pg'
backup maximum age: FAILED (interval provided: 14 days, latest backup age: No available backups)
compression settings: OK
failed backups: OK (there are 0 failed backups)
2017-12-08 05:56:34,175 [14559] barman.server ERROR: Check 'minimum redundancy requirements' failed for server 'pg'
minimum redundancy requirements: FAILED (have 0 backups, expected at least 3)
pg_basebackup: OK
pg_basebackup compatible: OK
pg_basebackup supports tablespaces mapping: OK
pg_receivexlog: OK
pg_receivexlog compatible: OK
2017-12-08 05:56:34,367 [14559] barman.server ERROR: Check 'receive-wal running' failed for server 'pg'
receive-wal running: FAILED (See the Barman log file for more details)
archiver errors: OK
编辑:添加的输出barman receive-wal pg
$ sudo barman receive-wal pg
2017-12-10 01:48:01,129 [25410] barman.utils WARNING: Failed opening the requested log file. Using standard error instead.
Starting receive-wal for server pg
2017-12-10 01:48:01,138 [25410] barman.server INFO: Starting receive-wal for server pg
2017-12-10 01:48:03,087 [25410] barman.wal_archiver INFO: Activating WAL archiving through streaming protocol
pg: pg_receivexlog: starting log streaming at 5A/A000000 (timeline 1)
2017-12-10 01:48:03,391 [25410] barman.command_wrappers INFO: pg: pg_receivexlog: starting log streaming at 5A/A000000 (timeline 1)
^CSIGINT received. Terminate gracefully.
2017-12-10 01:50:42,512 [25410] barman.wal_archiver INFO: SIGINT received. Terminate gracefully.
编辑:配置文件——
; --------------------
; Contents of /etc/barman.conf after removing all commented lines.
; --------------------
[barman]
barman_user = ubuntu
path_prefix = /home/ubuntu/pg/bin
configuration_files_directory = /home/ubuntu/barman.conf.d
barman_home = /home/ubuntu/barman
log_file = /var/log/barman/barman.log
log_level = INFO
compression = bzip2
retention_policy = RECOVERY WINDOW OF 1 MONTH
last_backup_maximum_age = 2 WEEKS
minimum_redundancy = 3
retention_policy = RECOVERY WINDOW OF 4 WEEKS
/home/ubuntu/barman.conf.d/pg.conf
:
; --------------------
; Contents of /home/ubuntu/barman.conf.d/pg.conf after removing all commented lines.
; --------------------
[pg]
description = "Postgres DB"
conninfo = host=REDACTED user=REDACTED dbname=REDACTED
backup_method = postgres
archiver = off
streaming_conninfo = host=REDACTED user=REDACTED dbname=REDACTED
streaming_archiver = on
slot_name = pgbackup
当你遇到这样的问题时,一定要仔细检查你的日志,
barman check
命令,并确保你设置了一个barman cron
条目 startbarman receive-wal
。barman switch-wal
在执行和完成设置之前需要运行它。=)您使用的是什么版本的 PostgreSQL 和 Barman?
在 PG 9.3 之前,没有以 FF 结尾的 WAL 文件,它从 FE 变为 00。
您似乎使用的是 PG < 9.3,但您的 Barman 版本并没有预料到这一点。