温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Mysql如何安装tokudb引擎

发布时间:2021-10-25 16:21:08 来源:亿速云 阅读:319 作者:柒染 栏目:MySQL数据库

Mysql如何安装tokudb引擎,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

平台支持:

    TokuDB 只能在 64-bit Linux 下使用.
最小内存要求:
    TokuDB 需要至少1GB 的物理内存,当然这里建议最好是 2GB 

安装tokuDB   

      tokuDB内存分配需要jemalloc支持(一般安装percona mysql以后自己就有,如果没有则需要额外安装)    

 1 安装jemalloc
  1.          yum install jemalloc
         编译安装参考:http://blog.itpub.net/29096438/viewspace-2122906/

 2:安装tokudb
  1. 二进制包安装:

  2. 下载:

  3. [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参数设置

  1. [mysqld_safe]
    malloc-lib=/usr/local/mysql/lib/libjemalloc.so
    plugin-dir =/usr/local/mysql/lib/mysql/plugin/

  2. #tokudb

  3. #把TokuDB datadir以及logdir和MySQL的datadir分开,美观点,也可以不分开,注释掉本行以及下面2行即可

  4. tokudb-data-dir = /data/mysql/zabbix_3306/tokudbData

  5. tokudb-log-dir = /data/mysql/zabbix_3306/tokudbLog

  6.  

  7. #TokuDB的行模式,建议用 FAST 就足够了,如果磁盘空间很紧张,建议用 SMALL

  8. #tokudb_row_format = tokudb_small

  9. tokudb_row_format = tokudb_fast

  10. tokudb_cache_size = 44G

  11.  

  12. #其他大部分配置其实可以不用修改的,只需要几个关键配置即可

  13. tokudb_commit_sync = 0

  14. tokudb_directio = 1

  15. tokudb_read_block_size = 128K

  16. tokudb_read_buf_size = 128K


若将上述参数写在[mysqld]下,则show engines中tokudb引擎不存在了了,失效了
若将上述参数写在[mysqld_safe]下,tokudb引擎还存在,也能建立tokudb表,但是这些参数配置是没生效的。。。。。。。待解决



注意:

  1. mysql版本:mysql官方社区版5.6.24 搭建成功后 新建表就重启,建标就重启


    1. 错误日志:遇到了bug?

    2. 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.



  2. 解决办法:换成percona server 

  3. 社区版5.6.24

  4. 得以解决

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI