Zabbix 5.0 LTS版本MySQL表分区及编译安装随记
分类:运维技术日期:2021-04-10 - 18:35:51评论:0条作者:老谢
Zabbix MySQL Database Partitioning 表分区优化禁用 housekeeping 提升历史数据清理性能
Zabbix 默认会启用 housekeeping 功能用于清理 history/trend 等历史数据,当监控服务器数量增加,保留时间有要求的情况下,housekeeping 的清理策略就会造成 Zabbix Server 性能下降,比如查询历史监控数据等。Zabbix 官方的建议是直接在数据库按照时间唯独创建分区表并定时清理,好处自然就是减少 Zabbix Server 的负担提升 Zabbix 应用对于数据库读写性能。Zabbix 3.4 之后的版本增加了对 Elasticsearch 的支持。
数据库的优化有横向和纵向扩展,这里使用数据的分布式,而分表可以看做是分布式的一种。。
在zabbix_server.conf文件中,找到如下两个参数:
(1)HousekeepingFrequency=1 解释:多久删除一次数据库里面的过期数据(间隔时间),默认一小时
(2)MaxHousekeeperDelete=5000 解释:每次删除数据量的上线(最大删除量),默认5000
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; +----------------------------+------------+ | Tables | Size in MB | +----------------------------+------------+ | history_uint | 16452.17 | | history | 3606.36 | | history_str | 2435.03 | | trends_uint | 722.48 | | trends | 176.28 | | history_text | 10.03 | | alerts | 7.47 | | items | 5.78 | | triggers | 3.72 | | events | 2.64 | | images | 1.53 | | items_applications | 0.70 | | item_discovery | 0.58 | | functions | 0.53 | | event_recovery | 0.38 | | item_preproc | 0.38 | ……………… |


最新评论
Josephlit:衷心感谢 美丽的地方描写。十分 ...
xiazaiall:个人论坛https://spssluntan.mybb...
雨帆:年纪越大越抠是真的,我现在就降级到了...
秦大叔:现在都是够用就好,不想太折腾了。
Andy烧麦:X1C 5th 2017年-2022年,走南闯北...
王叨叨:自从换了typecho,博客也不怎么出问...
王叨叨:我准备给我的老笔记本搞一个linux系...
大D:台式机现在只能是AMD YES!
springwood:查询了一下,ThinkPad x1c 9th ...
黑石:特斯拉和小米,选哪个?不是很懂车,就...