【问题标题】:Barman restore command behavior w.r.t PITRBarman 恢复命令行为 w.r.t PITR
【发布时间】:2020-08-07 23:34:19
【问题描述】:
我已经通过 rsync/SSH 和 WAL 流(在 barman 文档中提到的场景 2b)架构设置了备份,其中只有一个 PostgreSQL 和 Barman。
我正在尝试了解 PITR 如何与 barman recover 命令配合使用。如果在发出恢复命令时指定--target-time 的当前时间,预期的行为会是什么。从备份时间到当前时间,它会恢复到酒保上次收到的 WAL 吗?
谢谢
【问题讨论】:
标签:
postgresql
database-backups
barman
【解决方案1】:
对于可能有相同问题的其他人(鉴于文档对此并不清楚),我找到了答案,并且正如我所料。
是的,从备份时间到当前时间,它确实可以恢复到酒保上次收到的任何 WAL。
请参阅下面的控制台 sn-p 以供参考,
barman@4b412c1875cd:~$ date
Sat Aug 8 02:47:13 UTC 2020
barman@4b412c1875cd:~$ barman recover --target-time "2020-08-08 02:31:00+00:00" postgres-source-db 20200801T030001 /var/log/barman/TESTRESTOREFORTEST
Starting local restore for server postgres-source-db using backup 20200801T030001
Destination directory: /var/log/barman/TESTRESTOREFORTEST
Doing PITR. Recovery target time: '2020-08-08 02:31:00+00:00'
Copying the base backup.
Copying required WAL segments.
Generating recovery configuration
Identify dangerous settings in destination directory.
Recovery completed (start time: 2020-08-08 02:50:46.538480, elapsed time: 1 second)
Your PostgreSQL server has been successfully prepared for recovery!
barman@4b412c1875cd:~$
谢谢