http://www.ttlsa.com/mysql/install-handlersocket/

 

一、下载安装

# wget&nbsp; <a href="https://download.github.com/ahiguti-HandlerSocket-Plugin-for-MySQL-1.0.6-71-g159ea6d.tar.gz">https://download.github.com/ahiguti-HandlerSocket-Plugin-for-MySQL-1.0.6-71-g159ea6d.tar.gz</a>
 # tar zxvf ahiguti-HandlerSocket-Plugin-for-MySQL-1.0.6-71-g159ea6d.tar.gz
 # cd ahiguti-HandlerSocket-Plugin-for-MySQL-159ea6d
 # ./autogen.sh
 # ./configure --prefix=/usr/local/handlersocket \ # 指定安装目录
 --with-mysql-source=/usr/local/src/software/mysql-5.1.36 \&nbsp; # mysql源代码目录
 --with-mysql-bindir=/usr/local/mysql-5.1.36/bin \ # mysql二进制程序目录(bin)
 --with-mysql-plugindir=/usr/local/mysql-5.1.36/lib/mysql/plugin \ # mysql插件目录
 # make
 # make install 

二、修改配置文件
在my.cnf文件下增加以下配置:

[mysqld]    
 loose_handlersocket_port   = 9998       # 指定读请求端口号    
 loose_handlersocket_port_wr   = 9999    # 指定写请求端口号    
 loose_handlersocket_threads   = 16      # 指定读线程数目    
 loose_handlersocket_threads_wr  = 1     # 指定写线程数目

三、安装handlersocket.so:

# mysql -uroot -p123456    
 mysql> INSTALL PLUGIN handlersocket SONAME 'handlersocket.so';# 安装

四、查看进程状态

# netstat -ntpl    
 tcp       0      0 0.0.0.0:3306       0.0.0.0:*        LISTEN      31402/mysqld    
 tcp       0      0 0.0.0.0:9998       0.0.0.0:*        LISTEN      31402/mysqld    
 tcp       0      0 0.0.0.0:9999       0.0.0.0:*        LISTEN      31402/mysqld

五、常见问题
1) configure: error: MySQL source version does not match MySQL binary version

解决方法,在configure.in文件中首行添加一行[MySQL Server] 5.1.36