zabbix数据库清理

2017-12-28  本文已影响0人  好想静静_2970

这个是用于查找数据库大小的命令。

SELECT table_schema , sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"  FROM information_schema.TABLES GROUP BY table_schema;

这个命令可以用来查找最大的几个table size

SELECT table_name AS "Tables",

round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"

FROM information_schema.TABLES

WHERE table_schema = 'zabbix'

ORDER BY (data_length + index_length) DESC;

我这边运行了这个命令后, 就这个两个table: history_uint (30GB) 和 history (24GB) 就用掉几乎全部的空间了。 这样的话,目标已经找到。

再运行这个命令, 用来确认是否有日期行。 可惜没有,那么就不能按照日期来删除记录了

desc history_uint

field, type, null, key, default,extra

最后就剩下trancate命令了

truncate table history;

truncate table history_uint;

运维QQ交流群:171586999

上一篇下一篇

猜你喜欢

热点阅读