阿里云RDS迁移,极简安装 MySQL TokuDB 引擎


阿里云RDS迁移,极简安装 MySQL TokuDB 引擎

文章插图
 
背景zabbix 数据库由阿里云 RDS 迁移至自建 DB,迁移过程中发现 RDS 存储引擎为 tokudb ,手把手撸一遍
前置要求 Prerequisites
  • 安装 libjemalloc library
yum install jemalloc -y通过 yum 安装,生成的库文件为 /usr/lib64/libjemalloc.so.1
[root@yunwei /www/server/data]# rpm -qa |grep jemallocjemalloc-3.6.0-1.el7.x86_64[root@yunwei /www/server/data]# rpm -ql jemalloc-3.6.0-1.el7.x86_64/usr/bin/jemalloc.sh/usr/lib64/libjemalloc.so.1/usr/share/doc/jemalloc-3.6.0/usr/share/doc/jemalloc-3.6.0/COPYING/usr/share/doc/jemalloc-3.6.0/README/usr/share/doc/jemalloc-3.6.0/VERSION/usr/share/doc/jemalloc-3.6.0/jemalloc.html
  • Transparent huge pages 关闭内存大页
echo never > /sys/kernel/mm/transparent_hugepage/enabledecho never > /sys/kernel/mm/transparent_hugepage/defrag检查结果
root@ptest:~# cat /sys/kernel/mm/transparent_hugepage/enabledalways madvise [never]root@ptest:~# cat /sys/kernel/mm/transparent_hugepage/defragalways madvise [never]安装仓库源Installing Percona Server for MySQL from Percona yum repository
  • Install the Percona repository
$ yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpmRetrieving https://repo.percona.com/yum/percona-release-latest.noarch.rpmPreparing...                ########################################### [100%]1:percona-release        ########################################### [100%]
  • To install Percona Server for MySQL with SElinux policies
$ yum install http://repo.percona.com/centos/7/RPMS/x86_64/Percona-Server-selinux-56-5.6.42-rel84.2.el7.noarch.rpm
  • 测试仓库可用性
yum list | grep percona...Percona-Server-56-debuginfo.x86_645.6.25-rel73.1.el6@percona-release-x86_64Percona-Server-client-56.x86_645.6.25-rel73.1.el6@percona-release-x86_64Percona-Server-devel-56.x86_645.6.25-rel73.1.el6@percona-release-x86_64Percona-Server-server-56.x86_645.6.25-rel73.1.el6@percona-release-x86_64Percona-Server-shared-56.x86_645.6.25-rel73.1.el6@percona-release-x86_64Percona-Server-test-56.x86_645.6.25-rel73.1.el6@percona-release-x86_64Percona-Server-shared-compat.x86_645.1.68-rel14.6.551.rhel6percona-release-x86_64...
  • 安装 Percona Serve
yum install Percona-Server-server-56安装 TokuDBYou can install the Percona Server for MySQL with TokuDB engine by using the apt/yum commands:
[root@centos ~]# yum install Percona-Server-tokudb-56.x86_64# debian 系列 OSroot@wheezy:~# apt-get install percona-server-tokudb-5.6启用 TokuDB 引擎Enabling the TokuDB Storage EngineOnce the TokuDB server package has been installed following output will be shown:
This release of Percona Server is distributed with TokuDB storage engine. Run the following script to enable the TokuDB storage engine in Percona Server:
ps_tokudb_admin --enable -u <mysql_admin_user> -p[mysql_admin_pass] [-S <socket>] [-h <host> -P <port>]
See http://www.percona.com/doc/percona-server/5.6/tokudb/tokudb_installation.html for more installation details
See http://www.percona.com/doc/percona-server/5.6/tokudb/tokudb_intro.html for an introduction to TokuDB
Percona Server for MySQL 5.6.22-72.0 has implemented ps_tokudb_admin script to make the enabling the TokuDB storage engine easier. This script will automatically disable Transparent huge pages, if they’re enabled, and install and enable the TokuDB storage engine with all the required plugins. You need to run this script as root or with sudo. After you run the script with required parameters:
ps_tokudb_admin --enable -uroot -pPassw0rdFollowing output will be displayed:
Checking if Percona server is running with jemalloc enabled...>> Percona server is running with jemalloc enabled.Checking transparent huge pages status on the system...>> Transparent huge pages are currently disabled on the system.Checking if thp-setting=never option is already set in config file...>> Option thp-setting=never is not set in the config file.>> (needed only if THP is not disabled permanently on the system)Checking TokuDB plugin status...>> TokuDB plugin is not installed.Adding thp-setting=never option into /etc/mysql/my.cnf>> Successfuly added thp-setting=never option into /etc/mysql/my.cnfInstalling TokuDB engine...>> Successfuly installed TokuDB plugin.


推荐阅读