【发布时间】:2021-08-06 00:27:25
【问题描述】:
对某个由其他人完成的 Postgres 实施的新手,需要帮助解决问题。
我们配置了以下归档命令,如果我理解正确,那么归档命令会将 WAL 文件复制到已挂载的存储 /mnt/database:
archive_command = 'if { egrep -q " /mnt/database .* rw," /proc/mounts ;} && { ! pgrep test -u postgres ;} ; then test ! -f /mnt/database/%f && cp %p /mnt/database/%f ; else exit 1; fi'
然后我们有一个 cron 作业来将损坏的 WAL 移开:
find /mnt/database -type f -regextype posix-extended -regex ".*[A-Z0-9]{24}$" -mmin +60 -size -16777216c -exec logger "Trimming Postgres WAL Logs" \; -exec find /var/lib/pgsql/9.6/data/pg_xlog/{} -type f \; -exec mv {} {}.incomplete \;
我们遇到的问题是 /mnt/database 不断填满,我们需要每隔几天扩展一次磁盘。那是因为我们有过多的 WAL 写入或太多损坏的 WAL 文件吗?
【问题讨论】:
标签: postgresql