Percona Server for MySQL 安装TokuDB引擎

裘禄
2023-12-01

Percona Server for MySQL 安装TokuDB引擎

TokuDB主要优点:insert数据比Innodb快的多,数据压缩比要Innodb高
官方文档https://docs.percona.com/percona-server/5.7/installation/

1.安装perconna源

yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm

2.安装依赖

yum install epel-release -y
yum install jemalloc -y

3.配置文件添加

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

4.检查是否启用了透明大页面

cat /sys/kernel/mm/transparent_hugepage/enabled

关闭大页内存

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

5.安装tokudb插件

yum install  Percona-Server-tokudb-57.x86_64

6.启动数据库

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

7.查看数据库初始密码

grep 'temporary password' /var/log/mysqld.log

8.登录数据库修改密码

mysql> alter user root@'localhost' identified by '[密码]';

9.加载插件

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[密码]

10.重启数据库后查看引擎

mysql> show engines;
+--------------------+---------+
| Engine             | Support |
+--------------------+---------+
......
|TokuDB              | YES     |  .......
......
 类似资料: