Mysql如何安装tokudb引擎-创新互联

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 /tupian/20230522/percona-server 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. 得以解决

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联-成都网站建设公司行业资讯频道,感谢您对创新互联的支持。


分享名称:Mysql如何安装tokudb引擎-创新互联
网站网址:http://hbruida.cn/article/cshpsh.html