Fez operações:
barman cron
barman receive-wal --create-slot pg
barman receive-wal pg
barman switch-wal --force --archive pg
Em seguida, execute o comando check and backup:
-bash-4.2$ barman check pg
Server pg:
PostgreSQL: OK
is_superuser: OK
PostgreSQL streaming: OK
wal_level: OK
replication slot: OK
directories: OK
retention policy settings: OK
backup maximum age: OK (no last_backup_maximum_age provided)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: OK (have 0 backups, expected at least 0)
pg_basebackup: OK
pg_basebackup compatible: OK
pg_basebackup supports tablespaces mapping: OK
systemid coherence: OK (no system Id stored on disk)
pg_receivexlog: OK
pg_receivexlog compatible: OK
receive-wal running: OK
archive_mode: OK
archive_command: OK
archiver errors: OK
-bash-4.2$ barman backup pg
Starting backup using postgres method for server pg in /var/lib/barman/pg/base/20200305T124531
Backup start at LSN: 0/5100A7B8 (000000010000000000000051, 0000A7B8)
Starting backup copy via pg_basebackup for 20200305T124531
(pending)
Não pode terminar depois de muito tempo. /var/lib/barman/pg/base/20200305T124531/
Caminho verificado :
- backup.info
- dados
Em data
, parece que os dados do servidor pg já foram copiados. Veja o conteúdo em backup.info
:
backup_label=None
begin_offset=42936
begin_time=2020-03-05 12:45:31.020705+09:00
begin_wal=000000010000000000000051
begin_xlog=0/5100A7B8
config_file=/var/lib/pgsql/10/data/postgresql.conf
copy_stats=None
deduplicated_size=None
end_offset=None
end_time=None
end_wal=None
end_xlog=None
error=None
hba_file=/var/lib/pgsql/10/data/pg_hba.conf
ident_file=/var/lib/pgsql/10/data/pg_ident.conf
included_files=None
mode=postgres
pgdata=/var/lib/pgsql/10/data
server_name=pg
size=None
status=STARTED
systemid=6795775088862271947
tablespaces=None
timeline=1
version=100012
xlog_segment_size=16777216
Verifique o processo, obteve:
barman 5661 0.0 0.2 258560 19204 ? Ss 12:45 0:00 /usr/bin/python2 /bin/barman -c /etc/barman.conf -q receive-wal pg
barman 5671 0.0 0.0 176384 3416 ? S 12:45 0:00 /usr/pgsql-10/bin/pg_receivewal --dbname=dbname=replication host=pg options=-cdatestyle=iso replication=true user=streaming_barman application_name=barman_receive_wal --verbose --no-loop --no-password --directory=/var/lib/barman/pg/streaming --slot=barman
postgres 5675 0.0 0.0 397052 3844 ? Ss 12:45 0:00 postgres: wal sender process streaming_barman 127.0.0.1(41570) streaming 0/534365C8
barman 5745 0.0 0.2 258564 19080 pts/0 S+ 12:45 0:00 /usr/bin/python2 /bin/barman backup pg
barman 5751 0.0 0.0 176132 3316 pts/0 S+ 12:45 0:00 /bin/pg_basebackup --dbname=dbname=replication host=pg options=-cdatestyle=iso replication=true user=streaming_barman application_name=barman_streaming_backup -v --no-password --pgdata=/var/lib/barman/pg/base/20200305T124531/data --no-slot --wal-method=none
postgres 5752 0.0 0.0 396724 7980 ? Ss 12:45 0:00 postgres: wal sender process streaming_barman 127.0.0.1(41618) sending backup "pg_basebackup base backup"
Por que não pode terminar? status=STARTED
Não foi atualizado para concluir o status.
O motivo foi que fiz a recuperação após a primeira operação de backup. Em seguida, Barman definiu um comando string
#BARMAN#
adiante no arquivo!archive_command = 'barman-wal-archive backup pg %p'
postgresql.conf
Portanto, não pode chamar esse comando quando fizer o segundo backup.
Remova a corda, ele funciona.
O design visa não permitir que o usuário use
archive_command
novamente após a recuperação?