做过操作:
barman cron
barman receive-wal --create-slot pg
barman receive-wal pg
barman switch-wal --force --archive pg
然后运行检查和备份命令:
-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)
很长一段时间后它无法完成。检查/var/lib/barman/pg/base/20200305T124531/
路径:
- 备份信息
- 数据
在data
中,似乎已经复制了来自 pg 服务器的数据。请参阅中的内容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
检查过程,得到:
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"
为什么不能完成?status=STARTED
未更新完成状态。
原因是我在第一次备份操作后进行了恢复。然后巴曼在文件中设置了一个字符串
#BARMAN#
提前archive_command = 'barman-wal-archive backup pg %p'
命令postgresql.conf
!所以第二次备份时不能调用该命令。
删除字符串,它的工作原理。
旨在恢复后不允许用户
archive_command
再次使用的设计?