一个伪linux粉丝的blog

  1. 首页
  2. unix/linux
  3. 正文

How to cleanup Postgres WAL files

15 12 月, 2020 1231点热度 0人点赞 0条评论

1. 问题描述

某客户反馈 无法跑流水线,卡在第一步 git 阶段,检查发现节点 磁盘严重不足,提示 fatal write error : No space left on device,仅剩余2.5M,自然无法完成 git 下载任务。

进一步检查发现 有一个 /data/pg/stolon-keeper-0/postgres/pg_wal 目录占用了45G左右,里面有将近2800 多个 数字串文件,每个16兆

 

 

2. 原因分析

查看了容器里面 /stolon-data/postgres/postgresql.conf 参数, 里面有一行  wal_keep_segments = '8' ,

按照介绍,应该只是最多占用 8*16=128M 空间,而实际wal文件个数超过2800,占用44G,某种原因导致参数未生效,导致磁盘使用猛增。

3. 解决方法

找到几个文档,改参数不一定能很快见效,决定先手动清理。

  • 定位当前检查点文件

命令 : pg_controldata /stolon-data/postgres

得到   Latest checkpoint's REDO WAL file: 00000001000000190000006E

如下图

  • 清理pg_wal目录

pg_archivecleanup -d /stolon-data/postgres/pg_wal/ 00000001000000190000006E

即00000001000000190000006E 之前的文件被安全清理了,类似下图结果。

再次检查磁盘,磁盘使用率仅4%,清理效果非常的好,问题解决。

 

4.  参考链接

PostgreSQL 清理redo(xlog,wal,归档)的机制 及 如何手工清理

https://www.postgresql.org/docs/10/pgarchivecleanup.html

相关文章:

  1. "too many open files" from kubectl logs
  2. download files from qiniu
  3. plowshare -- command-line application to download files for file-sharing websites
  4. Can't execute jar- file: “no main manifest attribute”
标签: pg postgres stolon wal
最后更新:15 12 月, 2020

wanjie

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

This site uses Akismet to reduce spam. Learn how your comment data is processed.

归档
分类
  • network / 332篇
  • Uncategorized / 116篇
  • unix/linux / 121篇
  • 业界资讯 / 38篇
  • 公司杂事 / 11篇
  • 数码影像 / 12篇
  • 美剧 / 3篇
  • 美图共赏 / 21篇
  • 英语学习 / 3篇
标签聚合
泰国 nexus ssh ldap d90 dreamhost空间 天翼live postgres k8s wget deepseek debian Ubuntu openssl VPS Google squid jira dreamhost 虚拟主机 kubectl Google Voice 邮件归档 docker kernel google-chrome 浏览器 gitlab 网站运营 Nginx

COPYRIGHT © 2008-2025 wanjie.info. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang