见: http://www.percona.com/docs/wiki/repositories:start

一、CentOS下安装Percona-Server及HandlerSocket

安装Percona Yum Repository

 
rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.i386.rpm
rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
#自行选择对应的平台

yum install Percona-Server-server-51.i386 
yum install Percona-Server-client-51.i386

编辑my.cnf

 
[mysqld]
plugin-load=handlersocket.so

loose_handlersocket_port = 9998 # 指定读请求端口号
# the port number to bind to (for read requests) 

loose_handlersocket_port_wr = 9999 # 指定写请求端口号
# the port number to bind to (for write requests)

loose_handlersocket_threads = 16 # 指定读线程数目
# the number of worker threads (for read requests)

loose_handlersocket_threads_wr = 1 # 指定写线程数目
# the number of worker threads (for write requests)

open_files_limit = 65535
# to allow handlersocket accept many concurrent
# connections, make open_files_limit as large as
# possible.

重启MySQL后,查看handlersocket是否正常运行

 
netstat -lnp | grep 9998
netstat -lnp | grep 9999
#查看端口是否被监听



或者在mysql中查看
mysql> INSTALL PLUGIN handlersocket SONAME "handlersocket.so";
mysql>SHOW PLUGINS; # 查看插件是否加载成
mysql>SHOW PROCESSLIST; # 查看handlersocket是否正常运行


#如果handlersocket没有正常运行, 则先关闭SELinux后再试试看看。

二、Ubuntu下安装Percona-Server及HandlerSocket

安装apt-get源

 
gpg --keyserver  hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
gpg -a --export CD2EFD2A | apt-key add -

在ubuntu下其它操作同上,如果没有正常运行,
mysql> INSTALL PLUGIN handlersocket SONAME “handlersocket.so”; 提示: “errno: 2 failed to map segment from shared object: Permission denied”

可以先 /etc/init.d/apparmor stop 然后重启MySQL, 然后 /etc/init.d/apparmor start

发表评论

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