Percona Server 的安装及tokudb引擎的安装笔记

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Percona Server 的安装及tokudb引擎的安装笔记相关的知识,希望对你有一定的参考价值。

Percona Server 的安装及tokudb引擎的安装笔记


2017年7月7日


安装percona server:

yum localinstall Percona-Server-client-57-5.7.18-15.1.el6.x86_64.rpm  Percona-Server-shared-57-5.7.18-15.1.el6.x86_64.rpm Percona-Server-server-57-5.7.18-15.1.el6.x86_64.rpm  Percona-Server-tokudb-57-5.7.18-15.1.el6.x86_64.rpm

安装过程中,会自动安装jmelloc组件。



/etc/my.cnf 内容如下:

[client]

port    = 3306

socket   = /tmp/mysql.sock


[mysqld]

port    = 3306

socket   = /tmp/mysql.sock

datadir  = /var/lib/mysql

innodb_file_per_table=ON

character-set-server = utf8


server_id=1000


join_buffer_size = 256K

thread_stack = 256K


default_storage_engine = InnoDB


max_connections = 2000 

#slave-skip-errors  = 1032,1062

#性能相关调节

#跳过外部锁定,用于多进程条件下为MyISAM数据表进行锁定

skip-external-locking

sort_buffer_size = 4M

read_buffer_size = 4M

read_rnd_buffer_size = 4M

myisam_sort_buffer_size = 64M


#自适应哈希索引,在高并发复杂sql场景下有可能引发系统资源不足,大量spin waits ,lock waits 锁等待,导致崩溃

skip-innodb_adaptive_hash_index


#为所有线程打开表的数量

table_open_cache = 2048

#索引块的缓冲区大小

key_buffer_size = 128M

#MySQL查询结果缓冲区的大小

query_cache_type = OFF

query_cache_size = 0

#处理大的信息包量

max_allowed_packet = 16M


#1G=>8 2G=>16 3G=>32 >3G=>64

#缓存可重用的线程数

thread_cache_size = 64


event_scheduler = 1

long_query_time = 1

slow_query_log=1

slow_query_log_file = /var/lib/mysql/log-slow-queries.log

log-error   = /var/lib/mysql/error.log


max_binlog_size = 256m


transaction_isolation = READ-COMMITTED


#innodb_io_capacity=1000


master_info_repository = TABLE

relay_log_info_repository = TABLE

relay_log_recovery = 1 #crash safe

log-bin=mysql-bin

binlog_format=row

sync_binlog =1  

log-slave-updates

log_bin_trust_function_creators = 1

binlog_rows_query_log_events=ON


expire_logs_days = 5

auto_increment_increment=1

auto_increment_offset=1

skip-slave-start

skip-name-resolve


binlog_cache_size = 16M

binlog_stmt_cache_size=16M


########innodb settings########

innodb_buffer_pool_instances = 4  #小于逻辑CPU个数,尽可能调大一点

innodb_log_buffer_size = 16777216

innodb_read_io_threads = 4 #小于逻辑CPU个数/2,尽可能调大一点

innodb_write_io_threads=4 # <=(逻辑CPU个数 -read_io_threads)  ,尽可能调大一点

innodb_purge_threads = 2

innodb_flush_method=O_DIRECT



# Timeout

connect_timeout = 20

wait_timeout = 14400

interactive_timeout = 14400

net_write_timeout = 180

lock_wait_timeout = 120


tmp_table_size=200M

max_heap_table_size=200M


sql_mode = ‘NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER‘


[mysqldump]

quick

max_allowed_packet = 16M


[mysql]

no-auto-rehash

# Remove the next comment character if you are not familiar with SQL

#safe-updates

prompt =‘[\\[email protected]\\h:\\d] >‘


[myisamchk]

key_buffer_size = 512M

sort_buffer_size = 512M

read_buffer = 8M

write_buffer = 8M


[mysqlhotcopy]

interactive-timeout





初始化数据库:

/usr/sbin/mysqld --initialize-insecure  --basedir=/usr/sbin/ --user=mysql --datadir=/var/lib/mysql/

# 说明:使用 --initialize-insecure参数,不让mysqld初始化时候生成随机密码,保持空密码


启动数据库:

/etc/init.d/mysql start



设置数据库密码:

mysql

> set password=PASSWORD(‘[email protected]‘);

> flush privileges;

> exit




然后,开始安装tokudb引擎:

官方详细的安装步骤: https://www.percona.com/doc/percona-server/5.7/tokudb/tokudb_installation.html



1 禁用Transparent huge pages

cat /sys/kernel/mm/transparent_hugepage/enabled

[always] madvise never

always代表已启用


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

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


# 将设置写入到文件,防止重启配置丢失

echo ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled‘ >> /etc/rc.local

echo ‘echo never > /sys/kernel/mm/transparent_hugepage/defrag‘ >> /etc/rc.local



2、安装并启用tokudb引擎:

## 可以使用INSTALL PLUGIN方法安装,也可以使用ps_tokudb_admin这个工具进行配置(推荐使用ps_tokudb_admin)

执行 ps_tokudb_admin -uroot [email protected] --enable

会自动在 /etc/my.cnf 在加入下面的1行配置

[mysqld_safe] 

thp-setting=never


然后再执行 ps_tokudb_admin -uroot [email protected] --enable-backup

会自动在 /etc/my.cnf 在加入下面的1行配置

[mysqld_safe] 

preload-hotbackup


这样就完成了TokuDB engine plugin和TokuBackup plugin插件的安装。




重启mysqld进程。

/etc/init.d/mysql restart 

mysql -uroot [email protected]

> show engines;

> show plugins;

> SELECT @@tokudb_version;


都可以看到tokudb启用了。


这样的话,我们重启了mysqld或者整个服务器的话,tokudb引擎也能在mysql重启时候再次自动加载。


本文出自 “菜鸡” 博客,请务必保留此出处http://lee90.blog.51cto.com/10414478/1945419

以上是关于Percona Server 的安装及tokudb引擎的安装笔记的主要内容,如果未能解决你的问题,请参考以下文章

Zabbix 3.0 for percona-server TokuDB

MySQL社区版升级到Percona Server

Percona TokuDB

Percona5.7 TokuBackup支持TokuDB热备份

TokuDB安装

percona server 8.0主从同步延迟分析