编写目的
根据(postgres12数据库备份方式三)上一章节和配置,讲解如何实现主备切换,在这章讲解如何实现主服务归档还原。
归档还原
#1.在主服务器停止到postgres服务
systemctl stop postgresql
#2.将postgres.conf文件中 restore_command,archive_cleanup_command,recovery_target_time的井号注释去掉(#)
vi /data/postgres_dbdata/postgresql.conf
#还原归档数据
restore_command = \'cp /data/postgres_archivedir/%f %p\'
#清除归档数据
archive_cleanup_command=\'pg_archivecleanup /data/postgres_archivedir %r\'
#指明要恢复到时间,修改时间
recovery_target_time=\'2022-01-11 14:35:12\'
#创建还原文件
touch /data/postgres_dbdata/recovery.signal
systemctl start postgresql
0 条评论
请不要发布违法违规有害信息,如发现请及时举报或反馈!
还没有人评论呢,速度抢占沙发!