Linux command
pg_archivecleanup 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Clean old WAL files
pg_archivecleanup [archive_dir] [oldest_kept_wal]
Dry run
pg_archivecleanup -n [archive_dir] [oldest_kept_wal]
Clean with extension
pg_archivecleanup -x .gz [archive_dir] [oldest_kept_wal]
说明
pg_archivecleanup removes old WAL archive files no longer needed by standby servers. It is typically used as archive_cleanup_command in postgresql.conf (or recovery.conf in older versions). It removes all WAL files older than the specified _oldestkeptwalfile_.
参数
- -b, --clean-backup-history
- Remove backup history files as well.
- -d, --debug
- Print debug logging output on stderr.
- -n, --dry-run
- Print the names of files that would be removed (dry run).
- -V, --version
- Print version and exit.
- -x, --strip-extension _extension_
- Strip this extension from filenames before deciding if they should be deleted. Useful for compressed archives (e.g., .gz, .bz2).
- -?, --help
- Show help and exit.
FAQ
What is the pg_archivecleanup command used for?
pg_archivecleanup removes old WAL archive files no longer needed by standby servers. It is typically used as archive_cleanup_command in postgresql.conf (or recovery.conf in older versions). It removes all WAL files older than the specified _oldestkeptwalfile_.
How do I run a basic pg_archivecleanup example?
Run `pg_archivecleanup [archive_dir] [oldest_kept_wal]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -b, --clean-backup-history do in pg_archivecleanup?
Remove backup history files as well.