前言

如果不做表分区和删除历史数据规则设置的话,随着时间的推移zabbix的查询性能会变得很低

 

查看zabbix的性能

通过zabbix的NVPS(每秒处理数值数)来衡量其性能,在zabbix的dashboard上有一个粗略的估值

Zabbix性能优化

 

数据库优化

一、设置独立表空间(innodb_file_per_table=1)  # 5.6版本以上自动开启 以上版本跳过这一段

1、删除history数据

truncate history
truncate history_uint

2、备份数据

mysqldump -uroot -p123456 zabbix > zabbix.sql

3、开启独立表空间

innodb_file_per_table=1

4、还原数据

mysql -uroot -p123456 zabbix < zabbix.sql

5、重启数据库  # 先删除ib_logfile0,ib_logfile1

/etc/init.d/mysqld restart

6、回收表空间(对应操作1)

optimize history
optimize history_uint

二、表分区

需要分区的表  # history* 有着一样的字段,存储着不同类型item的历史数据。trend* 有着一样的字段,存储着不同类型item的历史趋势数据

history
history_log
history_str
history_text
history_uint
trends
trends_uint

 表分区存储过程详细见 https://www.zabbix.org/wiki/Docs/howto/mysql_partition

 

加入计划任务

1 0 * * * /storage/server/mysql/bin/mysql -uroot -p123456 zabbix -e "CALL partition_maintenance_all('zabbix');"

 

参考:http://xianglinhu.blog.51cto.com/5787032/1700981

相关文章:

  • 2021-09-06
  • 2021-08-20
  • 2021-10-14
  • 2022-12-23
  • 2021-06-11
  • 2022-01-09
  • 2022-02-17
  • 2021-10-05
猜你喜欢
  • 2021-06-29
  • 2021-10-02
  • 2022-12-23
  • 2021-05-11
  • 2021-07-01
  • 2021-12-26
  • 2022-01-10
相关资源
相似解决方案