通过编译源码的方式安装MySQL,这里选择的版本是5.5.8版本。由于这不是本文的重点,这里只简单的提及一下要点。
首先到MySQL的官网http://dev.mysql.com/downloads/mysql/下载源码,要注意的是从MySQL 5.5版本开始需要Cmake编译工具和bison。然后开始安装:
安装完成后配置my.cnf文件,最重要的参数是分配给innodb存储引擎的内存大小,也就是innodb_buffer_pool_size参数,这里设置为2G。
[root@localhost mysql558]# vi my.cnf
……
innodb_buffer_pool_size = 2G
……
……
innodb_buffer_pool_size = 2G
……
二、安装HandlerSocket
首先到以下地址下载代码:
https://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL
开始安装HandlerSocket:
[root@localhost handlersocket]# tar -zxvf ahiguti-HandlerSocket-Plugin-for-MySQL-1.0.6-67-g25f4957.tar.gz
[root@localhost handlersocket]# cd handlersocket/
[root@localhost handlersocket]# cd handlersocket/
[root@localhost handlersocket]# ./autogen.sh
[root@localhost handlersocket]# ./configure --with-mysql-source=/home/handlersocket/mysql-5.5.8 --with-mysql-bindir=/home/handlersocket/mysql558/bin --with-mysql-plugindir=/home/handlersocket/mysql558/lib/plugin
[root@localhost handlersocket]# make
[root@localhost handlersocket]# make install
[root@localhost handlersocket]# ./configure --with-mysql-source=/home/handlersocket/mysql-5.5.8 --with-mysql-bindir=/home/handlersocket/mysql558/bin --with-mysql-plugindir=/home/handlersocket/mysql558/lib/plugin
[root@localhost handlersocket]# make
[root@localhost handlersocket]# make install
三、修改MySQL配置
在my.cnf配置文件增加以下内容:
[root@localhost mysql558]# vi my.cnf
[mysqld]
......
loose_handlersocket_port = 9998
# the port number to bind to (for read requests)
[mysqld]
......
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)
# the port number to bind to (for write requests)
loose_handlersocket_threads = 16
# the number of worker threads (for read requests)