First, download and install
# wget <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 \ # 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
Second, modify the configuration file
to add the following configuration in my.cnf file:
[mysqld]
loose_handlersocket_port = 9998 # 指定读请求端口号
loose_handlersocket_port_wr = 9999 # 指定写请求端口号
loose_handlersocket_threads = 16 # 指定读线程数目
loose_handlersocket_threads_wr = 1 # 指定写线程数目
Third, the installation handlersocket.so:
# mysql -uroot -p123456
mysql> INSTALL PLUGIN handlersocket SONAME 'handlersocket.so'; # 安装
Fourth, view the process status
# 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
V. Frequently Asked Questions
1) configure: error: MySQL source version does not match MySQL binary version solution, in configure.in file, add a line to the first line of [MySQL Server] 5.1.36 please indicate the source: http: // www .ttlsa.com / html / 101.html
Reproduced in: https: //my.oschina.net/766/blog/211106