Estou coçando a cabeça para resolver o seguinte erro, mas não fiz muito progresso:
$ 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
Eu já havia configurado o barman em um VPS descartável e tudo funcionou bem. Mas quando tentei replicar isso em nossa instância final do EC2, encontrei o problema mencionado acima. Assegurei o seguinte (mesmo que não me lembre de fazer isso no VPS):
- SSH do barman => pg está funcionando
- SSH de pg => barman está funcionando
- Todas as regras de firewall em 'pg' foram desabilitadas, temporariamente
Qual poderia ser o problema aqui?
Edit: Adicionando a saída debarman 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
Editar: Adicionado saída debarman 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.
Editar: arquivos de configuração --
; --------------------
; 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
Quando você se deparar com um problema como este, certifique-se de verificar novamente seus logs, o
barman check
comando e certifique-se de definir umabarman cron
entrada para iniciarbarman receive-wal
. Isso precisa estar em execução antes que você possa executarbarman switch-wal
e concluir sua configuração. =)Quais versões do PostgreSQL e Barman você está usando?
Antes do PG 9.3, não havia arquivos WAL terminando em FF, passou de FE para 00.
Parece provável que você esteja usando PG < 9.3, mas sua versão do Barman não espera isso.