TokuDB主要优点:insert数据比Innodb快的多,数据压缩比要Innodb高
官方文档https://docs.percona.com/percona-server/5.7/installation/
yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
yum install epel-release -y
yum install jemalloc -y
[mysqld_safe]
malloc-lib= /path/to/jemalloc
TokuDB存储引擎需要libjemalloc库3.3.0或更高版本。如果分发存储库中的版本低于该版本,您可以使用Percona Software存储库中的版本或从其他地方下载。
如果之前没有安装并启用libjemalloc,则在使用apt`或yum包管理器安装TokuDB存储引擎包时会自动安装,但需要重启Percona Server实例才能加载libjemalloc。这样,libjemalloc将使用LD_PRELOAD加载。您还可以通过在my.cnf文件的[mySQLD_Safe]部分中指定Malloc-lib变量来启用libjemalloc。
cat /sys/kernel/mm/transparent_hugepage/enabled
关闭大页内存
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
yum install Percona-Server-tokudb-57.x86_64
systemctl start mysql
查看数据库状态
[root@localhost ~]# systemctl status mysql
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2023-03-08 00:44:40 EST; 3min 25s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 8393 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 8336 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 8396 (mysqld)
CGroup: /system.slice/mysqld.service
└─8396 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
grep 'temporary password' /var/log/mysqld.log
mysql> alter user root@'localhost' identified by '[密码]';
mysql> INSTALL PLUGIN tokudb SONAME 'ha_tokudb.so';
mysql> INSTALL PLUGIN tokudb_file_map SONAME 'ha_tokudb.so';
mysql> INSTALL PLUGIN tokudb_fractal_tree_info SONAME 'ha_tokudb.so';
mysql> INSTALL PLUGIN tokudb_fractal_tree_block_map SONAME 'ha_tokudb.so';
mysql> INSTALL PLUGIN tokudb_trx SONAME 'ha_tokudb.so';
mysql> INSTALL PLUGIN tokudb_locks SONAME 'ha_tokudb.so';
mysql> INSTALL PLUGIN tokudb_lock_waits SONAME 'ha_tokudb.so';
mysql> INSTALL PLUGIN tokudb_background_job_status SONAME 'ha_tokudb.so';
或者
[root@localhost ~]# ps_tokudb_admin --enable -uroot -p[密码]
mysql> show engines;
+--------------------+---------+
| Engine | Support |
+--------------------+---------+
......
|TokuDB | YES | .......
......