使用Percona安装tokudb存储引擎

由分形树索引支持的PerconaTokuDB®是一款开源的,用于Percona Server的高性能存储引擎,可提高可扩展性和运行效率。专为满足大数据应用的苛刻要求而设计,Percona TokuDB降低了与压缩和优化工作相关的部署成本。Percona TokuDB和Percona HotBackup包含在下面的Percona Server for MySQL 下载链接中。

快速和可扩展性:

Percona TokuDB极大地提高了性能和并发性,减少了磁盘和闪存驱动器存储需求,支持在线模式更改并支持完全符合ACID的事务

Percona TokuDB可以:

  • 更好的性能:如果不进行调整,响应时间比ROCKSDB快20倍
  • 更强的投资回报率:运营和基础设施成本更低,可扩展性和灵活性更高
  • 可用性更高:在公共,私人和混合云环境中对苛刻应用的停机时间更少

1.安装percona官方RPM源

yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm

2.测试Percona源

yum list | grep percona

3.yum安装percona

yum install Percona-Server-server-57

4.Percona默认管理命令

service mysql start 
service mysql restart 
service mysql stop 
service mysql status

5.查询安装后的临时percona root密码

grep ‘temporary password’ /var/log/mysqld.log

6.修改数据库密码

mysql -u root -p
Enter password:yourpasswd
elcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 92
Server version: 5.7.21-21-log Percona Server (GPL), Release 21, Revision 2a37e4e

Copyright (c) 2009-2018 Percona LLC and/or its affiliates
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Percona [(none)]> set password=password(‘yournewpasswd’);

mysql有密码安全机制,注意设置为足够复杂的密码

7.编辑/etc/mycnf配置文件,修改mysql默认编码

[mysqld] 
character_set_server=utf8

8.安装jemalloc

yum install jemalloc 
rpm -qa |grep jemalloc 
rpm -qa |grep jemalloc 
jemalloc-3.6.0-1.el7.x86_64
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

记录下/usr/lib64/libjemalloc.so.1地址

9.配置jemalloc依赖文件,编辑/etc/my.cnf,其中加入以下内容:

[mysqld_safe] 
malloc-lib=/usr/lib64/libjemalloc.so.1

10.检查Transparent huge pages

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

11.安装tokudb

yum install Percona-Server-tokudb-57.x86_64

12.修改selinux状态为permissive,编辑编辑/etc/selinux/config修改以下内容:

selinux=permissive
setenforce 0

12.初始设置tokudb

ps-admin --enable-tokudb -uroot -p

输入密码,检查是否成功

13.重启percona

service mysql restart

14.检查确认是否启用tokudb

mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 94
Server version: 5.7.21-21-log Percona Server (GPL), Release 21, Revision 2a37e4e

Copyright (c) 2009-2018 Percona LLC and/or its affiliates
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Percona [(none)]> show engines;
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                                    | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                                         | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                                      | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                                         | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears)             | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                                      | NO           | NO   | NO         |
| TokuDB             | DEFAULT | Percona TokuDB Storage Engine with Fractal Tree(tm) Technology             | YES          | YES  | YES        |
| TokuDB             | YES     | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES          | YES  | YES        |
| ARCHIVE            | YES     | Archive storage engine                                                     | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables                  | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                             | NULL         | NULL | NULL       |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
10 rows in set (0.07 sec)

看到tokudb即为成功。

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注