zabbix 更换 TokuDB 过程(我用的是percona db):
wget http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/binary/redhat/6/x86_64/Percona-Server-tokudb-56-5.6.19-rel67.0.el6.x86_64.rpm yum install jemalloc rpm -ivh Percona-Server-tokudb-56-5.6.19-rel67.0.el6.x86_64.rpm
执行:
mysql -e "INSTALL PLUGIN tokudb SONAME ‘ha_tokudb.so‘;" mysql -e "INSTALL PLUGIN tokudb_file_map SONAME ‘ha_tokudb.so‘;" mysql -e "INSTALL PLUGIN tokudb_fractal_tree_info SONAME ‘ha_tokudb.so‘;" mysql -e "INSTALL PLUGIN tokudb_fractal_tree_block_map SONAME ‘ha_tokudb.so‘;" mysql -e "INSTALL PLUGIN tokudb_trx SONAME ‘ha_tokudb.so‘;" mysql -e "INSTALL PLUGIN tokudb_locks SONAME ‘ha_tokudb.so‘;" mysql -e "INSTALL PLUGIN tokudb_lock_waits SONAME ‘ha_tokudb.so‘;"
修改my.cnf 文件:
plugin-dir = /usr/lib64/mysql/plugin plugin-load=ha_tokudb.so tokudb_row_format = tokudb_fast tokudb_cache_size = 8G tokudb_commit_sync = 0 tokudb_directio = 1 tokudb_read_block_size = 128K tokudb_read_buf_size = 128K
重启mysql 服务
/etc/init.d/mysql restart
修改表引擎:
mysql>use zabbix mysql>alter table history_uint engine=TokuDB; mysql>alter table history engine=TokuDB;
完成后再看文件:
409M _zabbix_sql_8a46_c_key_history_uint_1_f_1_19_B_0.tokudb 190M _zabbix_sql_8a46_c_key_history_1_26c_1_19_B_0.tokudb
压缩比还是很厉害
防止内存泄露,执行:
echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/defrag
最后,如何使用TokuDB?
如果你要存储blob,不要使用TokuDB,因为它限制记录不能太大;
如果你的记录数量过亿,使用TokuDB;
如果你注重update的性能,不要使用TokuDB,它没有Innodb快;
如果你要存储旧的记录,使用TokuDB;
如果你想要缩小数据占用的存储空间,使用TokuDB;
查看:http://rdc.taobao.com/blog/cs/?p=1176
参考:http://itindex.net/detail/50162-zabbix-%E6%95%B0%E6%8D%AE%E5%BA%93-tokudb