ZABBIX6 清理 Mysql 历史数据
1、按时间戳清理监控历史数据:
use zabbix;
MariaDB [zabbix]> delete from history where clock < 1556640000;
MariaDB [zabbix]> delete from history_uint where clock < 1556640000;
MariaDB [zabbix]> delete from history_log where clock < 1556640000;
第二种清理方法:
truncate table history;
optimize table history;
truncate table history_log;
optimize table history_log;
truncate table history_uint;
optimize table history_uint;
truncate是清空整张表,然后根据表结构重新建立,delete删除的是记录的数据没有修改表
truncate执行删除比较快,但是在事务处理安全性方面不如delete