TOKUDB Storage engine installation, configuration, usage, and considerations

Source: Internet
Author: User
Tags create index mysql in percona
Platform Support:
Tokudb can only be used under 64-bit Linux.
Minimum memory requirements:
TOKUDB requires at least 1GB of physical memory, and of course it is recommended that 2GB be the best.


1, install MySQL (can be mariadb, Percona or Oracle MySQL)

Install the Percona source yum install http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm

Test is available
Yum List | grep Percona

Then choose the appropriate version [here choose 5.6.17] installation can, very simple here is not much nonsense.


2. Installation Tokudb

Tokudb memory allocation requires JEMALLOC support (general installation Percona after MySQL itself, if not the need for additional installation)

(1), install jemalloc yum install Jemalloc

(2), installation Tokudb
Binary Package Installation
Cd/usr/local/src
Wget-c http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/binary/tarball/ Percona-server-5.6.17-rel66.0-608.tokudb.linux.x86_64.tar.gz
TAR-ZXVF percona-server-5.6.17-rel66.0-608.tokudb.linux.x86_64.tar.gz

MV Percona-server-5.6.17-rel66.0-608.tokudb.linux.x86_64 percona-server-5.6.17-rel66.0-608.tokudb.linux.x86_64

Then link or copy the ha_tokudb.so under/usr/local/src/percona-server-5.6.17-rel66.0-608.linux.x86_64/lib/mysql/plugin to MySQL

Plugin directory [/database1/mysql/percona-server-5.6.17-rel66.0-608.linux.x86_64/lib/mysql/plugin/] Or you can use the RPM binary package installation, this is also simple and not much explanation
Yum-y Install percona-server-tokudb-56.x86_64

modifying system parameters
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
The proposal is written in the/etc/rc.local and can be effective after reboot
Login MySQL Execution:

INSTALL PLUGIN tokudb_file_map soname ' ha_tokudb.so ';
INSTALL PLUGIN tokudb_fractal_tree_info soname ' ha_tokudb.so ';
INSTALL PLUGIN tokudb_fractal_tree_block_map soname ' ha_tokudb.so ';
INSTALL PLUGIN tokudb_trx soname ' ha_tokudb.so ';
INSTALL PLUGIN tokudb_locks soname ' ha_tokudb.so ';
INSTALL PLUGIN tokudb_lock_waits soname ' ha_tokudb.so ';
INSTALL PLUGIN tokudb soname ' ha_tokudb.so '; # # #安装这个后会生成toku相应的日志文件和回滚文件等, you need to delete (if the specified data files and log files are not in the default MySQL data directory) and then restart the Toku parameters after my.cnf configuration.

Recommended parameters: Tokudb_commit_sync=on
tokudb_cache_size=10g # #指定tokuDB可使用的缓存类似innodb Innodb_buffer_pool_size default is 50% of physical memory
Tokudb_directio=on # #写操作不经过缓存, write directly to disk
Row_format=tokudb_fast # #指定行格式默认是tokudb_zlib
Tokudb_tmp_dir=/database1/mysql_tmpdir
Tokudb_write_status_frequency =1
Tokudb_read_status_frequency=1
Tokudb_data_dir=/xxx/yyy
TOKUDB_LOG_DIR=/XXX/YYY Note that the specified directory must exist and have accessible permissions


If you want to uninstall
UNINSTALL PLUGIN tokudb;
UNINSTALL PLUGIN Tokudb_file_map;
UNINSTALL PLUGIN Tokudb_fractal_tree_info;
UNINSTALL PLUGIN Tokudb_fractal_tree_block_map;
UNINSTALL PLUGIN Tokudb_trx;
UNINSTALL PLUGIN tokudb_locks;
UNINSTALL PLUGIN tokudb_lock_waits; Also enter the data directory to delete tokudb related files
and comment out the MY.CNF toku related configuration parameters can be


Possible error in installation '/database1/mysql/percona-sever-4005/lib/mysql/plugin/ha_tokudb.so ' (errno:13/database1/mysql/ Percona-sever-4005/lib/mysql/plugin/ha_tokudb.so:
Cannot open shared object File:no such file or directory is clearly the database plug-in directory does not have a ha_tokudb.so shared library, make a soft connection or copy ha_tokudb.so to Percoan MySQL in the plugin directory can be
Such as:
Ln-s/usr/local/src/percona-server-5.6.17-rel66.0-608.linux.x86_64/lib/mysql/plugin/ha_tokudb.so/database1/ Mysql/percona-sever-4005/lib/mysql/plugin/ha_tokudb.so


Finally show engines the TOKUDB engine
Figure 1
Or show PLUGINS, or you can


(3) Create a table using Tokudb

CREATE TABLE ' Toku ' (

' PID ' varchar not NULL DEFAULT ',

' Createtime ' datetime not NULL,

' Updatetimes ' datetime not NULL,

' user_id ' bigint not NULL,

' homework_id ' varchar (255) DEFAULT NULL,

' Complete_practice ' int (one) not NULL DEFAULT ' 0 ',

' varchar ' (256) not NULL DEFAULT ',

' clazz_id ' bigint not NULL DEFAULT ' 0 ',

' Score ' bigint not NULL DEFAULT ' 0 ',

' Note_checkeds ' bit (1) not NULL DEFAULT B ' 0 ',

PRIMARY KEY (' pid ')

) Engine=tokudb

(4), some notices 1, ALTER TABLE XXX ENGINE=TOKUDB situation will add metadata lock blocking insert update, and myql-5.6.17 InnoDB engine will not cause blocking.
2. Only char, varchar, varbinary, and integer field type extensions support the online DDL "shrink does not support online operation", note that when modified, the field properties cannot be changed. Also cannot be any primary key or two-level index of the field "Level two index, you can delete the two-level index, but tokudb CREATE index two-level index is not fast", otherwise it will cause the copy table.
3, modify the column name must be a single column modification, if it is a statement at the same time to modify more than one statement will copy the table.
4. These field time, ENUM, BLOB, Tinyblob, Mediumblob, Longblob type do not support online DDL.
Some other restrictions can be referred to the official website

(5), tokudb things, lock information view

View things: SELECT * from Information_schema.tokudb_trx,
Information_schema.processlist
WHERE trx_mysql_thread_id = ID;

View the situation of the lock
SELECT ID from Information_schema.tokudb_locks,
Information_schema.processlist
WHERE locks_mysql_thread_id = ID;

Warning :
Do not move any tokudb-related files, otherwise it will cause the database to crash and need to use Backup to recover.

(6), about TOKUDB row format Tokudb_row_format can set several values as follows:
Tokudb_default: Sets the default compression behavior. In TOKUDB version 7.1.0, the default zlib library is used for compression, and future versions may change.
Tokudb_fast: Use the QUICKLZ Library's compression mode.
Tokudb_small: Use the LZMA Library's compression mode.
Tokudb_zlib: Uses the Zlib Library's compression mode to provide medium-level compression ratios and medium-level CPU consumption.

Tokudb_quicklz: Use the QUICKLZ Library's compression mode to provide lightweight compression ratios and lower basic CPU consumption. Tokudb_lzma: Uses LZMA library compression mode, provides high compression ratio and high CPU consumption.
Tokudb_uncompressed: Do not use compression mode.
You can modify the row format using the following command:
ALTER TABLE table_name Row_format=row_format;
Note Modifying the row format is also a online operation.

Spit Groove:

The engine is now generally used for archival storage of a large amount of historical data, but the most lethal is the lack of a suitable backup tool, which can only use mysqldump backups or physical backup downtime, seemingly official physical backup tool charges.


Then there is time to replenish Tokudb's pressure-test report.


Reference: http://docs.tokutek.com/tokudb/tokudb-index-installation.html

There is an article on the TOKUDB performance test online Please refer to: HTTP://WWW.TUICOOL.COM/ARTICLES/VABIFJB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.