容器应用,  系统运维

Sentry 服务磁盘占满 清除postgresql方法

Sentry服务运行一段时间后,磁盘就满了

docker exec -it  onpremise_worker_1 /bin/bash

root@38e544a6037f:/usr/src/sentry# sentry cleanup --days 3
06:38:00 [INFO] sentry.plugins.github: apps-not-configured
Removing expired values for LostPasswordHash
Removing expired values for ApiGrant
Removing expired values for ApiToken
Removing old NodeStore values
Removing EventMapping for days=3 project=*

要删除很长时间

再运行df -h 发现还是很满。这是因为cleanup的使用delete命令删除postgresql数据,但postgrdsql对于delete, update等操作,只是将对应行标志为DEAD,并没有真正释放磁盘空间。

再运行以下命令进入 postgresql数据库的docker

docker exec -it  onpremise_postgres_1 /bin/bash

vacuumdb -U postgres -d postgres -v -f --analyze

这样就能完成删除了

留言

您的电子邮箱地址不会被公开。 必填项已用*标注

闽ICP备20008591号-1