Sentry日志收集系统修复

Sentry上线将近两个月以后崩溃,崩溃的原因有两个:

1、运行postgresql容器的机器磁盘空间被耗尽,导致数据库停止服务

2、运行Nginx和sentry web的docker无法重启。

修复sentry的过程因此分为两个步骤:

1、对postgresql中30天以前的数据进行清理,恢复磁盘空间。

2、对运行sentry web和nginx的机器重装docker,由于nginx和sentry web server不保存状态,因此重新搭建web server不会造成数据丢失。

  • postgresql磁盘空间清理:

这里对应的操作应该被称为database rotation,sentry本身有名为cleanup的工具,可以利用cleanup删除过期数据。

但是,cleanup要求数据库提供服务。在sentry 搭建时,postgresql为主备搭建,主库所在机器磁盘已被耗尽,数据库服务无法启动。幸好备库还有20G左右的剩余空间,可以考虑清理备库的磁盘空间,然后将备库升为主库,再将原主库磁盘清空,同步新主库的数据。这样做会损失一部分数据,好在sentry记录的数据不是特别重要。

  • cleanup:

sentry的cleanup工具操作帮助为

root@9acfe6561812:/# sentry cleanup --help
Usage: sentry cleanup [OPTIONS]

  Delete a portion of trailing data based on creation date.

  All data that is older than `--days` will be deleted.  The default for this is 30 days.  In
  the default setting all projects will be truncated but if you have a specific project you want
  to limit this to this can be done with the `--project` flag which accepts a project ID or a
  string with the form `org/project` where both are slugs.

Options:
  --days INTEGER         Numbers of days to truncate on.  [default: 30]
  --project TEXT 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值