Mysql如何安装tokudb引擎
Mysql如何安装tokudb引擎,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
平台支持:
TokuDB 只能在 64-bit Linux 下使用.
最小内存要求:
TokuDB 需要至少1GB 的物理内存,当然这里建议最好是 2GB
安装tokuDB
tokuDB内存分配需要jemalloc支持(一般安装percona mysql以后自己就有,如果没有则需要额外安装)
1 安装jemalloc
yum install jemalloc
编译安装参考:http://blog.itpub.net/29096438/viewspace-2122906/
2:安装tokudb
二进制包安装:
下载:
[root@host-192-168-1-56 plugin]# wget https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.24-72.2/binary/tarball/Percona-Server-5.6.24-rel72.2-TokuDB.Linux.x86_64.ssl101.tar.gz
解压拷贝tokudb.so至mysql plugin目录即可
[root@host-192-168-1-56 plugin]# cp ha_tokudb.so /home/data/mysql/lib/plugin/
修改内核配置,禁用transparent_hugepage,不关闭的话可能会导致TokuDB内存泄露(建议写到 /etc/rc.local 中,重启后仍可生效):
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
安装即可
mysql> INSTALL PLUGIN tokudb_file_map SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.07 sec)
mysql> INSTALL PLUGIN tokudb_fractal_tree_info SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_fractal_tree_block_map SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_trx SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_locks SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_lock_waits SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.38 sec)
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| TokuDB | YES | Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology | YES | YES | YES |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
10 rows in set (0.04 sec)
4 配置文件tokudb参数设置
[mysqld_safe]
malloc-lib=/usr/local/mysql/lib/libjemalloc.so
plugin-dir =/usr/local/mysql/lib/mysql/plugin/#tokudb
#把TokuDB datadir以及logdir和MySQL的datadir分开,美观点,也可以不分开,注释掉本行以及下面2行即可
tokudb-data-dir = /data/mysql/zabbix_3306/tokudbData
tokudb-log-dir = /data/mysql/zabbix_3306/tokudbLog
#TokuDB的行模式,建议用 FAST 就足够了,如果磁盘空间很紧张,建议用 SMALL
#tokudb_row_format = tokudb_small
tokudb_row_format = tokudb_fast
tokudb_cache_size = 44G
#其他大部分配置其实可以不用修改的,只需要几个关键配置即可
tokudb_commit_sync = 0
tokudb_directio = 1
tokudb_read_block_size = 128K
tokudb_read_buf_size = 128K
若将上述参数写在[mysqld]下,则show engines中tokudb引擎不存在了了,失效了
若将上述参数写在[mysqld_safe]下,tokudb引擎还存在,也能建立tokudb表,但是这些参数配置是没生效的。。。。。。。待解决
注意:
mysql版本:mysql官方社区版5.6.24 搭建成功后 新建表就重启,建标就重启
错误日志:遇到了bug?
Version: '5.6.24-log' socket: '/home/data/mydata/3308/mysql.sock' port: 3308 Source distribution
08:44:47 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=8096
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 3220280 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.解决办法:换成percona server
社区版5.6.24
得以解决
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注行业资讯频道,感谢您对的支持。