TokuDB安装

安装TokuDB

1, 创建mysql数据目录                    #顺便把临时目录创建好
mkdir -p /data/mysql/tmp                                   
groupadd -r mysql
useradd -g mysql -r -s /sbin/nologin -M -d /data/mysql mysql
chown -R mysql:mysql /data/mysql	

2, 编辑配置文件vim /etc/my.cnf
[mysqld]
datadir=/data/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
bind-address=xx(替换为内网IP地址)
#unique_checks=OFF
#tokudb_commit_sync=OFF
#tokudb_fsync_log_period=1000
max_connections=1000
#default-storage-engine=TokuDB	#先把这一条配置注释掉,因为这时候还没安装TokuDB,不注释的话mysql会启动失败,等安装完TokuDB引擎后再打开这行配置
tmpdir=/data/mysql/tmp/    #修改临时数据存放目录(默认是tmp下面,如果查日志时临时数据比较大的话会差不到,会报警磁盘不够。)

[mysqld_safe]
thp-setting=never
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


3, 安装
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
yum install Percona-Server-tokudb-56.x86_64

4, 启动

#   (如需安装多实例)初始化数据库实例并启动数据库
#    /usr/bin/mysql_install_db --user=mysql --datadir=/data/mysql_toku_3307 --basedir=/usr/ --defaults-file=/data/mysql_toku_3307/my.cnf &
#    /usr/bin/mysqld_safe --defaults-file=/data/mysql_toku_3307/my.cnf --user=mysql &
# mysql_install_db

4.1初始化数据库:
/usr/bin/mysql_install_db --user=mysql --datadir=/data/mysql --basedir=/usr/

service mysql start

5, 增加用户
echo "insert into mysql.user (Host,User,Password,ssl_cipher,x509_issuer,x509_subject) values('%','xx',password('xx'),'','','');grant all privileges on *.* to 'xx'@'%' identified by 'xx';flush privileges; " | mysql -uroot
 
6, 安装TokuDB引擎
ps_tokudb_admin --enable -uxx -pxx -h内网IP地址

7, 设置TokuDB为默认引擎
SET global default_storage_engine=TokuDB; (需要重新登录mysql才能看到生效)

8, 查看是否安装成功  show engines;  查看版本 SELECT @@tokudb_version;

mysql> 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         |
| MEMORY                  | YES     | Hash based, stored in memory, useful for temporary tables                                    | NO           | NO   | NO         |
| TokuDB                     | DEFAULT | Percona TokuDB Storage Engine with Fractal Tree(tm) Technology              | YES          | YES  | YES        |                   #看这个
| MyISAM                    | YES     | MyISAM storage engine                                                                                                   | NO           | NO   | NO         |
| ARCHIVE                  | YES     | Archive storage engine                                                                                                    | NO           | NO   | NO         |
| FEDERATED            | NO      | Federated MySQL storage engine                                                                                   | NULL         | NULL | NULL       |
| InnoDB                      | YES     | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys      | YES          | YES  | YES        |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
10 rows in set (0.00 sec)

mysql> SELECT @@tokudb_version;
+------------------+
| @@tokudb_version |
+------------------+
| 5.6.38-83.0      |                                  #看版本
+------------------+
1 row in set (0.00 sec)

9.修改系统文件描述符的数量
vim /etc/security/limits.conf

* soft nproc 655300
* hard nproc 655300
* soft nofile 655300
* hard nofile 655300

10.把/etc/my.cnf  里面的#default-storage-engine=TokuDB  注释打开并重启mysql
 /etc/init.d/mysql restart

  

posted @ 2019-07-03 17:04  GeminiMp  阅读(717)  评论(1编辑  收藏  举报