时间:2021-07-01 10:21:17 帮助过:245人阅读
1. pg_archivecleanup清理归档日志。 [postgres@postgres128 ~]$ pg_archivecleanup -? pg_archivecleanup removes older WAL files from PostgreSQL archives. Usage: pg_archivecleanup [OPTION]... ARCHIVELOCATION OLDESTKEPTWALFILE Options: -d generate debug output (verbose mode) -n dry run, show the names of the files that would be removed -V, --version output version information, then exit -x EXT clean up files if they have this extension -?, --help show this help, then exit For use as archive_cleanup_command in recovery.conf when standby_mode = on: archive_cleanup_command = ‘pg_archivecleanup [OPTION]... ARCHIVELOCATION %r‘ e.g. archive_cleanup_command = ‘pg_archivecleanup /mnt/server/archiverdir %r‘ Or for use as a standalone archive cleaner: e.g. pg_archivecleanup /mnt/server/archiverdir 000000010000000000000010.00000020.backup 1.1 当主库不断把WAL日志拷贝到备库。这个时候需要清理。在recovery.conf可以配置 e.g. archive_cleanup_command = ‘pg_archivecleanup /mnt/server/archiverdir %r‘ 1.2 可以收到执行命令。 e.g. pg_archivecleanup /home/postgres/arch/ 000000010000000000000009 在归档目录/home/postgres/arch/ 把000000010000000000000009之前的日志都清理。 2. pg_rman备份 参考博客 http://www.cnblogs.com/lottu/p/7490615.html 在pg_rman备份保留策略中。在每天都备份。可以清理归档日志。 对流复制环境中。备份一般是在备库。可以把归档日志传送到备库中。 --keep-arclog-files=NUM keep NUM of archived WAL --keep-arclog-days=DAY keep archived WAL modified in DAY days e.g 保留归档日志个数10。或者保留10天内的归档日志。 KEEP_ARCLOG_FILES = 10 KEEP_ARCLOG_DAYS = 10 在备份信息中会产生以下信息。 INFO: start deleting old archived WAL files from ARCLOG_PATH (keep files = 10, keep days = 10)
postgresql如何维护WAL日志/归档日志
标签:-o arch targe nbsp nim amp 16进制 segment 如何