percona 5.7 + tokudb

Percona + TokuDB 部署

# 参考资料
https://www.kancloud.cn/devops-centos/centos-linux-devops/395664

1、安装依赖包
yum -y install jemalloc-devel.x86_64 make gcc-c++ cmake bison-devel ncurses-devel  readline-devel  libaio-devel perl libaio wget lrzsz vim libnuma* bzip2 xz

2、修改系统参数限制
cat >> /etc/security/limits.conf <<"EOF"
#
###custom
#
*           soft   nofile       20480
*           hard   nofile       65535
*           soft   nproc        20480
*           hard   nproc        65535
EOF

cat >>/etc/sysctl.conf <<"EOF"
# kernel_flag
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 1024 65535
#net.ipv4.icmp_echo_ignore_all = 1  
#禁ping,如果有nagios监控,这步可省去

# 以下参数是对iptables防火墙的优化,防火墙不开,会有提示,可以忽略不理。
#net.nf_conntrack_max=25000000
#net.netfilter.nf_conntrack_tcp_timeout_established=180
#net.netfilter.nf_conntrack_tcp_timeout_time_wait=120
#net.netfilter.nf_conntrack_tcp_timeout_close_wait=60
#net.netfilter.nf_conntrack_tcp_timeout_fin_wait=120
vm.swappiness=0

sysctl -p >/dev/null

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
    echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
    echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi

2、下载软件
cd /opt/
wget https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.26-29/binary/tarball/Percona-Server-5.7.26-29-Linux.x86_64.ssl101.tar.gz

注意:此时不添加TokuDB配置,默认没有启用引擎

3、创建用户
groupadd mysql
useradd -g mysql mysql -d /home/mysql -s /sbin/nologin

mkdir -p /data/mysql3306
cd /opt/
tar -zxf Percona-Server-5.7.26-29-Linux.x86_64.ssl101.tar.gz
mv Percona-Server-5.7.26-29-Linux.x86_64.ssl101 /usr/local/
cd /usr/local/ && ln -s Percona-Server-5.7.26-29-Linux.x86_64.ssl101 mysql
#编辑/etc/my.cnf,配置文件见结尾附件
cd /usr/local/mysql/bin/ && ./mysqld --initialize-insecure --user=mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start
ln -s /tmp/mysql3306.sock /tmp/mysql.sock
ln -s /usr/local/mysql/bin/* /usr/bin/

# 启动成功后, 在/etc/my.cnf中 增加TokuDB配置文件
[mysqld]
# TokuDB settings #
skip-host-cache
tokudb_data_dir=/data/mysql3306
tokudb_log_dir=/data/mysql3306
tokudb_row_format=tokudb_fast
tokudb_cache_size = 2G
tokudb_commit_sync = 0
tokudb_directio = 1
tokudb_read_block_size = 128K
tokudb_read_buf_size = 1M
tokudb_commit_sync=OFF
tokudb_fsync_log_period=1000

[mysqld_safe]
thp-setting=never
malloc-lib= /usr/lib64/libjemalloc.so

# 安装配置tukudb, 过程会检查THP,Selinux,jemalloc
/usr/local/mysql/bin/ps-admin --enable -uroot -p -S /tmp/mysql3306.sock
[root@localhost][(none)]> use dbtest;
Database changed
[root@localhost][dbtest]>  SELECT @@tokudb_version;
+------------------+
| @@tokudb_version |
+------------------+
| 5.7.26-29        |
+------------------+
1 row in set (0.00 sec)

[root@localhost][dbtest]>

[root@localhost][dbtest]> show engines;
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                                    | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                                         | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                                         | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables                  | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears)             | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                                      | NO           | NO   | NO         |
| TokuDB             | YES     | 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         |
| InnoDB             | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES          | YES  | YES        |
| FEDERATED          | NO      | Federated MySQL storage engine                                             | NULL         | NULL | NULL       |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
10 rows in set (0.00 sec)

# 测试
create table t_tokudb (id bigint not null auto_increment primary key,strs varchar(256)) engine=tokudb default charset utf8mb4;
[root@localhost][dbtest]>  create table t_tokudb (id bigint not null auto_increment primary key,strs varchar(256)) engine=tokudb default charset utf8mb4;
Query OK, 0 rows affected (0.11 sec)

[root@localhost][dbtest]> show create table t_tokudb\G;
*************************** 1. row ***************************
       Table: t_tokudb
Create Table: CREATE TABLE `t_tokudb` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `strs` varchar(256) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=TokuDB DEFAULT CHARSET=utf8mb4
1 row in set (0.38 sec)

ERROR:
No query specified

[root@localhost][dbtest]>

附录:
cat >/etc/my.cnf<<"EOF"
[mysql]
prompt = [\\u@\\h][\\d]>\\_

[mysqld]
# base dir
basedir  = /usr/local/mysql/
socket = /tmp/mysql3306.sock
datadir = /data/mysql3306
pid_file  = /data/mysql3306/mysql3306.pid
innodb_undo_directory = /data/mysql3306/undolog/

## basic settings #
user = mysql
port = 3306
extra_port = 83306
autocommit = 1
character_set_server=utf8mb4
explicit_defaults_for_timestamp = 1
max_allowed_packet = 16777216

# connection #
interactive_timeout = 30
wait_timeout = 30
lock_wait_timeout = 5
skip_name_resolve = 1
max_connections = 1024

# session memory settings #
read_buffer_size = 8M
read_rnd_buffer_size = 16M
sort_buffer_size = 32M
tmp_table_size = 16M
join_buffer_size = 32M
thread_cache_size = 64

## log settings #
log_error = error.log
slow_query_log = 1
slow_query_log_file = slow.log
log_queries_not_using_indexes = 1
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log_throttle_queries_not_using_indexes = 10
expire_logs_days = 90
long_query_time = 2
min_examined_row_limit = 100
binlog-rows-query-log-events = 1
log-bin-trust-function-creators = 1
log-slave-updates = 1
log-bin=mysql-bin
#general_log=on
general_log_file=/data/mysql3306/general_log

## innodb settings #
innodb_page_size = 16384
innodb_buffer_pool_size = 1G
innodb_buffer_pool_instances = 1
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_flush_method = O_DIRECT
innodb_log_file_size = 536870912
innodb_log_files_in_group = 2
innodb_log_buffer_size = 16777216
innodb_purge_threads = 1
innodb_sort_buffer_size = 33554432
innodb_write_io_threads = 2
innodb_read_io_threads = 2
innodb_file_per_table = 1

# replication settings #
master_info_repository = TABLE
relay_log_info_repository = TABLE
sync_binlog = 1
binlog_format = ROW
server-id=237
EOF

create user 'admin'@'%' identified by 'adminpwd';
grant all on  *.* to 'admin'@'%' with grant option;
mysql -h 192.168.142.132 -P 3306 -uadmin -p'adminpwd'
mysql -h 192.168.142.132 -P 83306 -uadmin -p'adminpwd'

percona 5.7 + tokudb的更多相关文章

  1. Percona TokuDB

    Percona TokuDB Percona TokuDB 1.     TokuDB说明 2.     TokuDB安装 3.     使用TokuDB 3.1 快速插入和富索引 3.2 聚集sec ...

  2. MySQL社区版升级到Percona Server

    出于磁盘空间的考虑,在调研以后把磁盘空间紧张的库的引擎改为tokudb,(在改为tokudb引擎之前是innodb引擎,已经压缩过,但空间还是紧张)关于tokudb的优势各位自行查阅相关资料.要启用t ...

  3. MySQL 高性能存储引擎:TokuDB初探

    在安装MariaDB的时候了解到代替InnoDB的TokuDB,看简介非常的棒,这里对ToduDB做一个初步的整理,使用后再做更多的分享. 什么是TokuDB? 在MySQL最流行的支持全事务的引擎为 ...

  4. TokuDB的索引结构–分形树的实现

    分形树简介 原文:http://www.bitstech.net/2015/12/15/tokudb-index-introduction/ 分形树是一种写优化的磁盘索引数据结构. 在一般情况下, 分 ...

  5. MySQL-TokuDB:MySQL 高性能存储引擎:TokuDB

    ylbtech-MySQL-TokuDB:MySQL 高性能存储引擎:TokuDB 1.返回顶部 1. 在安装MariaDB的时候了解到代替InnoDB的TokuDB,看简介非常的棒,这里对ToduD ...

  6. Servlet3.0学习总结(二)——使用注解标注过滤器(Filter)

    Servlet3.0提供@WebFilter注解将一个实现了javax.servlet.Filter接口的类定义为过滤器,这样我们在web应用中使用过滤器时,也不再需要在web.xml文件中配置过滤器 ...

  7. Centos 6.5 Percona 5.6.27 Tokudb 配置

    参考 https://www.percona.com/doc/percona-server/5.6/tokudb/tokudb_installation.html # wget https://www ...

  8. 【MySQL】TokuDB引擎初探(MySQL升级为Percona,MySQL升级为MariaDB)

    参考:http://blog.sina.com.cn/s/blog_4673e6030102v46l.html 参考:http://hcymysql.blog.51cto.com/5223301/14 ...

  9. Percona Server 5.6 安装TokuDB

    系统:Red Hat Enterprise Linux Server release 6.3 (Santiago) 数据库:Percona-Server-5.6.29-rel76.2-Linux.x8 ...

随机推荐

  1. squid代理使用yum源

    参考文档:https://blog.csdn.net/tuolaji8/article/details/73613859https://www.centos.bz/2017/10/centos-7%E ...

  2. Java编程思想—八皇后问题(数组法、堆栈法)

    Java编程思想-八皇后问题(数组法.堆栈法) 实验题目:回溯法实验(八皇后问题) 实验目的: 实验要求: 实验内容: (1)问题描述 (2)实验步骤: 数组法: 堆栈法: 算法伪代码: 实验结果: ...

  3. 1.LTE系统概述

    信息源:中国大学MOOC 中搜索 移动通信网络与优化 兰州交通大学 3GPP协议:https://www.3gpp.org/DynaReport/36-series.htm 可以在中国大学MOOC中搜 ...

  4. python关键字以及含义,用法

    Python常用的关键字   1.and , or and , or 为逻辑关系用语,Python具有短路逻辑,False and 返回 False 不执行后面的语句, True or 直接返回Tru ...

  5. (转)JMeter性能测试-服务器资源监控插件详解

    零.引言 我们对被测应用进行性能测试时,除了关注吞吐量.响应时间等应用自身的表现外,对应用运行所涉及的服务器资源的使用情况,也是非常重要的方面,通过实时监控,可以准确的把握不同测试场景下服务器资源消耗 ...

  6. angular - ngFor, trackby

    ngFor ngForOf指令通常使用缩写形式*ngFor为集合中的每个项呈现模板的结构指令.该指令放置在元素上,该元素将成为克隆模板的父级. <li *ngFor="let item ...

  7. 列出连通集(DFS及BFS遍历图) -- 数据结构

    题目: 7-1 列出连通集 (30 分) 给定一个有N个顶点和E条边的无向图,请用DFS和BFS分别列出其所有的连通集.假设顶点从0到N−1编号.进行搜索时,假设我们总是从编号最小的顶点出发,按编号递 ...

  8. (转)终于有人把Elasticsearch原理讲透了!

    终于有人把Elasticsearch原理讲透了! 小史是一个非科班的程序员,虽然学的是电子专业,但是通过自己的努力成功通过了面试,现在要开始迎接新生活了. 来源:互联网侦察 | 2019-04-08 ...

  9. Git 设置 用户名 和 邮箱

    git config --global user.name "Vincent" git config --global user.email "********@qq.c ...

  10. iOS App沙盒目录结构

    转自:http://blog.csdn.net/wzzvictory/article/details/18269713 出于安全考虑,iOS系统的沙盒机制规定每个应用都只能访问当前沙盒目录下面的文件( ...