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. Flume采集日志

    角色 Source 数据来源 (exec, kafka, http…)Channel 数据通道 (memory,file,jdbc)Sink 数据目的地 (kafka,hdfs,es…) Agent ...

  2. 微信分享图标设置,以及wx.config配置

    最近公司要求我做一个关于页面分享微信显示小图和描述的功能,由于之前没有做过,所以说是从零开始,看jssdk说明文档,网上搜索各种资料,甚至连三四年前的内容都搜索出来了,也试过以前的简单方法,包括在页面 ...

  3. LeetCode.953-验证外语字典顺序(Verifying an Alien Dictionary)

    这是悦乐书的第364次更新,第392篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第226题(顺位题号是953).在外语中,令人惊讶的是,他们也使用英文小写字母,但可能使 ...

  4. 关于Qt中的QMutex——关于lock与unlock

    大概说一下用法,例子: QMutex mutex; int number = 6; void method1() { mutex.lock(); number *= 5; number /= 4; m ...

  5. HttpServletResponse ServletResponse 返回响应 设置响应头设置响应正文体 重定向 常用方法 如何重定向 响应编码 响应乱码

    原文地址:HttpServletResponse ServletResponse 返回响应 设置响应头设置响应正文体 重定向 常用方法 如何重定向 响应编码 响应乱码 HttpServletRespo ...

  6. mybatis返回List<Map>

    mapperl.xml中: <select id="getAmount" parameterType="int" resultType="jav ...

  7. poj1061(扩展欧基里德定理)

    题目链接:https://vjudge.net/problem/POJ-1061 题意:在一个首位相接的坐标轴上,A.B开始时分别位于X,Y处,每个单位时间向右移动m,n米,问是否能相遇,坐标轴长L. ...

  8. 图片水印处理-temp

    /media/watermark 简要描述: 用户注册接口 应用场景:比较复杂的水印处理,如需要多次添加水印,或者水印图片本身也需要处理,如果处理相对简单,java项目可以通过dubbo接口Image ...

  9. Linux系统装mycat

    最近在Linux系统中装载了一下mycut,记录过程以及所遇到的异常 首先是mycut的压缩包,直接放到linux中解压即可 链接:https://pan.baidu.com/s/1qo7z4tNvk ...

  10. SPOJ 4003 Phone List 题解

    题面 啊~,很水的一道trie树模板题: 当两个串存在关系时情况有两种: 若当前串插入后没有任何新建节点,则该串肯定是之前插入的某个串的前缀: 若在插入的时候,有某个经过的节点带有某串结尾的标记,则之 ...