日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

tokudb mysql_【MySQL】TokuDB引擎安装教程

發布時間:2025/3/20 数据库 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 tokudb mysql_【MySQL】TokuDB引擎安装教程 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

TokuDB引擎安裝起來貌似有點麻煩,在這里做個筆記,安裝幾步走

Percona MySQL5.6安裝

TokuDB引擎安裝

第一步咱們直接省略,跟官方版本MySQL5.6安裝方法基本相同,下面來寫下安裝TokuDB引擎安裝。

一、關閉內存大頁

echo never > /sys/kernel/mm/transparent_hugepage/enabled

echo never > /sys/kernel/mm/transparent_hugepage/defrag

查看下

root@ptest:~# cat /sys/kernel/mm/transparent_hugepage/enabled

always madvise [never]

root@ptest:~# cat /sys/kernel/mm/transparent_hugepage/defrag

always madvise [never]

二、安裝jemalloc

上傳jemalloc安裝包jemalloc-4.2.1.tar,這里聽銳志兄說3.6版本以上會出問題,但我這里貌似沒有問題。

上傳后直接解壓編譯安裝就可以了。

導入:

export LD_PRELOAD=/usr/local/jemalloc/lib/libjemalloc.so

查看是否導入成功:

#lsof -n | grep jemalloc

更改MySQL配置文件:(參考老葉的配置文件)

#

#my.cnf

#

# Percona-5.6.17, TokuDB-7.1.6,用于Zabbix數據庫參考配置

# 我的服務器配置:E5-2620 * 2,64G內存,1T可用磁盤空間(建議datadir所在分區設置為xfs文件系統)

# TokuDB版本:Percona-5.6.17, TokuDB-7.1.6(插件加載模式)

#

# created by yejr(http://imysql.com), 2014/06/24

#

[client]

port = 3306

socket = mysql.sock

#default-character-set=utf8

[mysql]

prompt="\\u@\\h \\D \\R:\\m:\\s [\\d]>

#pager="less -i -n -S"

tee=/home/mysql/query.log

no-auto-rehash

[mysqld]

open_files_limit = 8192

max_connect_errors = 100000

#buffer & cache

table_open_cache = 2048

table_definition_cache = 2048

max_heap_table_size = 96M

sort_buffer_size = 2M

join_buffer_size = 2M

tmp_table_size = 96M

key_buffer_size = 8M

read_buffer_size = 2M

read_rnd_buffer_size = 16M

bulk_insert_buffer_size = 32M

#innodb

#只有部分小表保留InnoDB引擎,因此InnoDB Buffer Pool設置為1G基本上夠了

innodb_buffer_pool_size = 1G

innodb_buffer_pool_instances = 1

innodb_data_file_path = ibdata1:1G:autoextend

innodb_flush_log_at_trx_commit = 1

innodb_log_buffer_size = 64M

innodb_log_file_size = 256M

innodb_log_files_in_group = 2

innodb_file_per_table = 1

innodb_status_file = 1

transaction_isolation = READ-COMMITTED

innodb_flush_method = O_DIRECT

#tokudb

malloc-lib= /usr/local/mysql/lib/mysql/libjemalloc.so

plugin-dir = /usr/local/mysql/lib/mysql/plugin/

plugin-load=ha_tokudb.so

#把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

重啟MySQL

三、安裝TokuDB引擎

ps_tokudb_admin --enable -uroot -p -S /tmp/mysql3306.sock

輸出如下:

[root@localhost bin]# ps_tokudb_admin --enable -uroot -p -S /tmp/mysql3306.sock

Enter password:

Checking SELinux status...

INFO: SELinux is in permissive mode.

cat: mysql.pid: No such file or directory

Checking if Percona Server is running with jemalloc enabled...

WARNING: The file /proc//environ is not readable so impossible to check LD_PRELOAD for jemalloc.

Possibly running inside container so assuming jemalloc is preloaded and continuing...

If there will be an error during plugin installation try to restart mysql service and run this script again.

Checking transparent huge pages status on the system...

INFO: Transparent huge pages are currently disabled on the system.

Checking if thp-setting=never option is already set in config file...

INFO: Option thp-setting=never is set in the config file.

Checking TokuDB engine plugin status...

INFO: TokuDB engine plugin is not installed.

Installing TokuDB engine...

INFO: Successfully installed TokuDB engine plugin.

表示TokuDB安裝成功,我們進入MySQL查看:

root@localhost [(none)]>show engines;

+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+

| Engine | Support | Comment | Transactions | XA | Savepoints |

+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+

| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |

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

| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |

| TokuDB | YES | Percona TokuDB Storage Engine with Fractal Tree(tm) Technology | YES | YES | YES |

| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |

| ARCHIVE | YES | Archive storage engine | NO | NO | NO |

| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |

| InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |

+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+

10 rows in set (0.00 sec)

至此,TokuDB安裝成功,后續會給大家帶來InnoDB與TokuDB引擎的性能測試對比。

總結

以上是生活随笔為你收集整理的tokudb mysql_【MySQL】TokuDB引擎安装教程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。