handlersockethandlersocket
mysql_config --version,源码使用configure.in找到包含[MySQLServer]的一行,从中取出版本,有的configure.in没有该行或者被修改过都会出错,可以人工添加一行注释#[MySQLServer] 5.1.x(使用mysql_config看到的版本)
安装:
make && make install
3.为mysql添加该插件
配置:
修改
vi my.cnf
在[mysqld]下(一定是要在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)
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.
以root登录mysql
mysql -hlocalhost -uroot -pxxxxx
安装插件:
mysql>install plugin handlersocket soname'handlersocket.so';
检查是否安装:
mysql>show processlist;
如果进程列表中有如下的,说明成功启动:
+----+-------------+-----------------+---------------+---------+------+-------------------------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-------------+-----------------+---------------+---------+------+-------------------------------------------+------------------+
| 1 | system user | connecting host | NULL | Connect | NULL |handlersocket: mode=rd, 0 conns, 0 active | NULL |
| 2 | system user | connecting host | NULL | Connect | NULL |handlersocket: mode=rd, 0 conns, 0 active | NULL |
4.安装php模块
HandlerSocket文档中提供了三种方式安装:
其中第一种pear方式安装成功(其实是移植perl的模块),第二种需要剥离PHPUnit代码,第三种模块编译成功(其实编译过程中也有很多问题,这里就不列出来了),但是load失败,会出现:
PHP Warning: PHP Startup: Unable to load dynamic library'/usr/local/php/lib/php/modules/handlersocket.so' -/usr/local/php/lib/php/modules/handlersocket.so: undefined symbol:__cxa_pure_virtual in Unknown on line 0
这样的错误,如果谁知道如何解决,请分享~
暂时还没有时间测试,改天做完测试再贴出来……
参考文档:
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-27118-1.html
打赢了