{"id":243,"date":"2011-06-09T22:36:54","date_gmt":"2011-06-09T14:36:54","guid":{"rendered":"http:\/\/guoh.ai\/lifelog\/?p=243"},"modified":"2011-07-05T16:28:53","modified_gmt":"2011-07-05T08:28:53","slug":"building-handler-socket-plugin-for-mysql","status":"publish","type":"post","link":"https:\/\/guoh.ai\/lifelog\/2011\/06\/building-handler-socket-plugin-for-mysql\/","title":{"rendered":"\u8bd5\u73a9HandlerSocket for MySQL"},"content":{"rendered":"<p>\u6709\u8fd9\u4e48\u4e00\u4e2a\u573a\u666f\uff0c\u5355\u53f0MySQL\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u6700\u5927\u8868\u7ea6500\u4e07\u8bb0\u5f55\uff0c\u5e38\u7528\u8868100\u4e07\u8bb0\u5f55\uff0c\u6bcf\u884c\u8bb0\u5f55\u7684\u6570\u636e\u91cf\u4e0d\u662f\u5f88\u5927<br \/>\n\u67e5\u8be2\u8fd8\u7b97\u9891\u7e41\uff0c\u63d2\u5165\u4fee\u6539\u5220\u9664\u6570\u636e\u4e0d\u662f\u90a3\u4e48\u591a\uff0c\u591a\u4e2a\u5e94\u7528\u540c\u65f6\u8bbf\u95ee\u8fd9\u4e2a\u6570\u636e\u5e93<br \/>\n\u6709\u4e2a\u5e94\u7528\u5c31\u662f\u67e5\u8be2\u4e3a\u4e3b\uff0c\u6ca1\u6709\u4fee\u6539\uff0c\u5c11\u91cf\u7684\u5220\u9664<br \/>\n\u67e5\u8be2SQL\u8bed\u53e5\u5f88\u7b80\u5355\uff0c\u6839\u636e\u7528\u6237ID\u67e5\u8be2\u4ed6\u4e0b\u9762\u7684\u8bb0\u5f55\uff08\u67d0\u4e9b\u5b57\u6bb5\uff09\uff0c\u6839\u636e\u8bb0\u5f55ID\u67e5\u8be2\u6574\u6761\u8bb0\u5f55\uff0c\u4e24\u8868\u5173\u8054\u67e5\u8be2100\u4e07\u7684\u5173\u8054500\u4e07<br \/>\n\u76ee\u524d\u5e94\u7528\u7684\u5b9e\u73b0\u4e5f\u5f88\u7b80\u5355\uff0c\u7b80\u964b\u7684\u6570\u636e\u5e93\u8fde\u63a5\u6c60\uff0c\u5ba2\u6237\u7aef\u53d1\u9001SQL\u8bed\u53e5\u5230SQL\u670d\u52a1\u5668<br \/>\n\u73b0\u5728\u4e5f\u6ca1\u6709\u9047\u5230\u5f88\u5927\u7684\u95ee\u9898\uff0c\u6ca1\u6709\u5b95\u673a\u4ec0\u4e48\u7684\u95ee\u9898\uff0c\u4f46\u5c31\u662f\u5ba2\u6237\u7aef\u53cd\u6620\u6162\uff0c\u4f46\u662f\u770b\u670d\u52a1\u5668\u7684\u8d1f\u8f7d\u90fd\u4e0d\u662f\u5f88\u9ad8<\/p>\n<p>\u6240\u4ee5\u8001\u5927\u5c31\u8bf4\u592a\u6162\u4e86\uff0c\u9700\u8981\u89e3\u51b3<\/p>\n<p>\u8fd9\u4e2a\u6162\u662f\u6bd4\u8f83\u663e\u7136\u7684\u554a\uff0c\u6bcf\u6b21\u89e3\u6790\u6267\u884cSQL\u8bed\u53e5\uff0c\u7f51\u7edc\u4f20\u8f93\uff0c\u6570\u636e\u5e93\u670d\u52a1\u5668\u5185\u5b58\u8f83\u5c0f\uff0c\u7f13\u5b58\u4e0d\u591f<\/p>\n<p>\u6240\u4ee5\u5f53\u7136\u5c31\u60f3\u5230\u4e86\u5728\u5e94\u7528\u5c42\u52a0\u7f13\u5b58\uff0c\u4f46\u662f\u5728\u51e0\u4e2a\u6708\u4e4b\u524d\u66fe\u7ecf\u770b\u5230\u8fc7HandlerSocket\u7684\u7b80\u5355\u4ecb\u7ecd\uff0c\u53ea\u77e5\u9053\u5b83\u53ef\u4ee5\u52a0\u5feb\u67e5\u8be2\uff0c\u6ca1\u6709\u7ec6\u770b<\/p>\n<p>\u6240\u4ee5\u7a81\u7136\u89c9\u5f97\u76ee\u524d\u8fd9\u4e2a\u4e5f\u53ef\u4ee5\u6539\u7528HandlerSocket\uff0c\u800c\u4e14\u66f4\u5408\u9002\uff0c\u5411\u8001\u5927\u5efa\u8bae\uff0c\u5f53\u7136\u5efa\u8bae\u90fd\u662f\u6728\u6709\u7528\u7684\uff0c\u56e0\u4e3a\u6211\u505a\u4e0d\u9e1f\u4e3b\uff0c\u8001\u5927\u6709\u8001\u5927\u7684\u60f3\u6cd5<\/p>\n<p>\u6240\u4ee5\u53ea\u80fd\u81ea\u5df1\u7814\u7a76\u770b\u770b\u8fd9\u4e2a\u4e1c\u897f\u9002\u5408\u4e0d\u4e86<\/p>\n<p>\u4e8e\u662f\u5c31\u5f00\u59cb\u4e0b\u8f7d\u7f16\u8bd1\u5b89\u88c5\u8fd9\u4e2a\u4e1c\u897f\u4e86\uff0c\u6b65\u9aa4\u8fd8\u7b97\u7b80\u5355<\/p>\n<p>\u5177\u4f53\u5b89\u88c5\u53c2\u89c1installation.en.txt<\/p>\n<p>\u6211\u5f00\u59cb\u60f3\u75285.1\u7684\u6e90\u7801\u548c5.5\u7684\u4e8c\u8fdb\u5236\u7248\u672c\u6df7\u5408\u7f16\u8bd1\uff08\u76ee\u524d\u6211\u81ea\u5df1\u7528\u76845.5\u7684MySQL\uff09\uff0c\u5929\u77e5\u9053\u80fd\u4e0d\u80fd\u6210\u529f\uff08\u6700\u540e\u662f\u4e0d\u80fd\u6210\u529f\u7684\uff0c\u6211\u53c8\u75285.1\u7684\u6e90\u7801\u91cd\u65b0\u7f16\u8bd1\u4e86\u4e00\u4e2aMySQL\u6570\u636e\u5e93\u51fa\u6765\uff0c\u7136\u540e\u7f16\u8bd1HandlerSocket\u5e76\u628a\u5b83\u5b89\u88c5\u52305.1\u4e2d\u4e86\uff0c\u540e\u6765\u770b\u5230\u4ecb\u7ecd\u662f\u6e90\u7801\u7248\u672c\u4e00\u5b9a\u8981\u548c\u5f53\u524d\u5b89\u88c5\u7684\u6570\u636e\u5e93\u7684\u7248\u672c\u4e00\u81f4\uff0c\u4e4b\u6240\u4ee5\u9700\u8981\u6e90\u7801\u662f\u56e0\u4e3aHandlerSocket\u63d2\u4ef6\u7528\u5230\u4e86MySQL\u6e90\u7801\u4e4b\u4e2d\u7684\u51e0\u4e2a\u5934\u6587\u4ef6\u4e4b\u7c7b\u7684\u5427\uff0c\u603b\u4e4b\u4e0d\u770bREADME\u662f\u5f88\u5934\u75bc\u7684\u3002\u6bd4\u5982\u6709\u7684\u9152\u5e97\u7684\u7535\u68af\u662f\u8981\u7528\u623f\u5361\u5237\u4e86\u7535\u68af\u4e4b\u540e\u624d\u80fd\u6309\u697c\u5c42\u7684\uff0cREADME\u5199\u7684\u6e05\u6e05\u695a\u695a\uff0c\u6c57\uff09<br \/>\n\u6211\u7684\u7f16\u8bd1\u6b65\u9aa4\u5982\u4e0b<br \/>\n$ .\/autogen.sh<br \/>\n$ .\/configure &#8211;with-mysql-source=\/home\/guohai\/dev\/src\/database\/mysql-5.1.57 &#8211;with-mysql-bindir=\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686\/bin &#8211;with-mysql-plugindir=\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686\/lib\/mysql\/plugin<\/p>\n<p>$ make<br \/>\n$ sudo make install<\/p>\n<p>mysql> install plugin handlersocket soname &#8216;handlersocket.so&#8217;;<br \/>\nQuery OK, 0 rows affected (0.03 sec)<\/p>\n<p>mysql> show plugins;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+<br \/>\n| Name          | Status | Type           | Library          | License |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+<br \/>\n| binlog        | ACTIVE | STORAGE ENGINE | NULL             | GPL     |<br \/>\n| partition     | ACTIVE | STORAGE ENGINE | NULL             | GPL     |<br \/>\n| CSV           | ACTIVE | STORAGE ENGINE | NULL             | GPL     |<br \/>\n| MEMORY        | ACTIVE | STORAGE ENGINE | NULL             | GPL     |<br \/>\n| InnoDB        | ACTIVE | STORAGE ENGINE | NULL             | GPL     |<br \/>\n| MyISAM        | ACTIVE | STORAGE ENGINE | NULL             | GPL     |<br \/>\n| MRG_MYISAM    | ACTIVE | STORAGE ENGINE | NULL             | GPL     |<br \/>\n| handlersocket | ACTIVE | DAEMON         | handlersocket.so | BSD     |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+<br \/>\n8 rows in set (0.00 sec)<\/p>\n<p>\u8fd9\u6837\u63d2\u4ef6\u5c31\u5b89\u88c5\u597d\u4e86\uff0c\u63a5\u4e0b\u6765\u5c31\u662f\u88c5\u4e2a\u5ba2\u6237\u7aef\u8bd5\u8bd5\u770b\u4e86\uff0c\u7528\u7684\u6dd8\u5b9d\u7684\u90a3\u4e2a<\/p>\n<p>\u5f53\u7136\u8fd8\u8981\u5728my.cnf\u4e2d\u589e\u52a0\u7c7b\u4f3c\u53c2\u6570<br \/>\nloose_handlersocket_port = 9998<br \/>\n# the port number to bind to (for read requests)<br \/>\nloose_handlersocket_port_wr = 9999<br \/>\n# the port number to bind to (for write requests)<br \/>\nloose_handlersocket_threads = 16<br \/>\n# the number of worker threads (for read requests)<br \/>\nloose_handlersocket_threads_wr = 1<br \/>\n# the number of worker threads (for write requests)<br \/>\nopen_files_limit = 65535<br \/>\n# to allow handlersocket accept many concurrent<br \/>\n# connections, make open_files_limit as large as<br \/>\n# possible.<\/p>\n<p>\u5f04hs4j\u8fd8\u662f\u62a5\u4e86\u51e0\u4e2a\u9519\u8bef\uff0c\u4ec0\u4e48open_table\uff0c\u539f\u56e0\u662f\u6211\u8868\u540d\u6ca1\u6709\u5199\u5bf9\uff0c\u5de8\u6c57\uff0c\u4e0d\u8fc7\u8fd9\u4e2a\u63d0\u793a\u4e5f\u591f\u74dc\u7684<br \/>\n\u4f30\u8ba1\u4e5f\u662f\u6211\u6ca1\u6709\u7406\u89e3\u8fd9\u4e2a\u4e1c\u897f<\/p>\n<p>\u7136\u540e\u6211\u53c8\u62a5\u4e86\u4e2a\u9519\u8bef<br \/>\nException in thread &#8220;main&#8221; com.google.code.hs4j.exception.HandlerSocketException: Connection has been closed<br \/>\n\tat com.google.code.hs4j.impl.HSClientImpl.awaitResponse(HSClientImpl.java:417)<br \/>\n\tat com.google.code.hs4j.impl.HSClientImpl.insert0(HSClientImpl.java:325)<br \/>\n\tat com.google.code.hs4j.impl.HSClientImpl.insert(HSClientImpl.java:309)<br \/>\n\tat com.google.code.hs4j.example.HS4JExample.main(HS4JExample.java:29)<br \/>\n\u8fd9\u4e2a\u6211\u628akeys\u5199\u5c11\u4e86\u4e00\u4e2a\uff0c\u6240\u4ee5\u62a5\u9519\u4e86<br \/>\n\u603b\u4e4b\u90fd\u662f\u6211\u7684\u95ee\u9898<\/p>\n<p>\u5c31\u8fd9\u6837\u89e3\u51b3\u51e0\u4e2a\u95ee\u9898\u4e4b\u540e\u5ba2\u6237\u7aef\u5c31\u57fa\u672c\u53ef\u7528\u4e86<\/p>\n<p>\u7136\u540e\u6211\u8fd8\u8bd5\u4e86\u4e0bPython\u7684\u5ba2\u6237\u7aef\uff0c\u88c5\u597dPython\u7684\u63d2\u4ef6http:\/\/packages.python.org\/python-handler-socket\/<br \/>\n\u5c31\u53ef\u4ee5\u5f00\u59cb\u73a9\u4e86\uff0c\u7167\u7740\u4f8b\u5b50\u4e5f\u5f88\u7b80\u5355<\/p>\n<p>\u770b\u4e86\u8fd8\u7b97\u591a\u7684\u6587\u7ae0\u4ecb\u7ecd\u4ee5\u53caissues\uff0c\u8fd9\u4e2a\u4e1c\u897f\u5728\u67d0\u4e9b\u7279\u5b9a\u7684\u60c5\u51b5\u4e0b\u8fd8\u662f\u53ef\u4ee5\u5f00\u59cb\u7528\u7684\u5427\uff0c\u4ee5\u524d\u63d0\u7684\u6bd4\u8f83\u591a\u7684\u95ee\u9898\uff0c\u4ec0\u4e48auto_increment\u4e4b\u7c7b\u7684\u4e5f\u90fd\u89e3\u51b3\u4e86<\/p>\n<p>\u89c9\u5f97\u6700\u5173\u952e\u7684\u662f\u5c31\u662f\u53c2\u6570\u600e\u4e48\u914d\u7f6e\uff0c\u624d\u80fd\u8ba9\u8fd9\u4e2a\u4e1c\u897f\u5728\u9700\u8981\u7684\u573a\u666f\u4e0b\u53d1\u6325\u6700\u5927\u7684\u80fd\u529b<\/p>\n<p>\u8fd8\u5f97\u591a\u770b\u770b\uff0c\u591a\u8bd5\u8bd5\u624d\u6709\u66f4\u5145\u5206\u7684\u628a\u63e1<\/p>\n<p>\u53c2\u8003<br \/>\nhttps:\/\/github.com\/ahiguti\/HandlerSocket-Plugin-for-MySQL<br \/>\nhttp:\/\/yoshinorimatsunobu.blogspot.com\/2010\/10\/using-mysql-as-nosql-story-for.html \u4f60\u61c2\u7684<br \/>\nhttps:\/\/github.com\/killme2008\/hs4j<br \/>\nhttp:\/\/whitesock.iteye.com\/blog\/811339<br \/>\nhttp:\/\/rdc.taobao.com\/team\/jm\/archives\/545<br \/>\nhttp:\/\/www.cnblogs.com\/inrie\/archive\/2011\/01\/28\/1946572.html \u7cfb\u5217\u6587\u7ae0<br \/>\nhttp:\/\/huoding.com\/2011\/04\/10\/62<\/p>\n<p>\u6d41\u6c34\u5e10\u603b\u662f\u5f88\u7b80\u5355\uff0c\u518d\u628a\u7f16\u8bd1MySQL\u7684\u4e3b\u8981\u8fc7\u7a0b\u4e5f\u8bb0\u5728\u8fd9\u91cc\u5427\uff0c\u51d1\u70b9\u5b57\u6570<br \/>\n\u6211\u7528\u7684\u662fUbuntu 10.10 X86\uff0c\u4ee5\u524d\u7f16\u8bd1\u8fc7\u5f88\u591a\u8f6f\u4ef6\u5f00\u53d1\u5305\uff0c\u6240\u4ee5\u5982\u679c\u7f16\u8bd1\u7684\u65f6\u5019\u9047\u5230\u7f3a\u4ec0\u4e48\u5305\u88c5\u4e0a\u5c31\u884c\u4e86<br \/>\n\u4e0b\u8f7d\u5c31\u4e0d\u8bf4\u4e86\uff0c\u4e0b\u8f7d\u90fd\u4e0d\u4f1a\u7684\u5c31\u4e0d\u8981\u4ece\u6e90\u7801\u7f16\u8bd1\u4e86\uff0c\u6211\u7528\u7684\u662fmysql-5.1.57.tar.gz<br \/>\n\u7f16\u8bd1\u53c2\u89c1INSTALL-SOURCE<br \/>\n2.11.2. Installing MySQL from a Standard Source Distribution<\/p>\n<p>$ .\/configure &#8211;prefix=\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686 &#8211;with-unix-socket-path=\/tmp\/mysql51.sock &#8211;with-tcp-port=3307 &#8211;with-named-curses-libs=\/lib\/libncurses.so.5 &#8211;enable-assembler &#8211;with-plugins=partition,innobase &#8211;with-charset=utf8 &#8211;with-collation=utf8_general_ci &#8211;with-extra-charsets=big5,ascii,gbk,utf8,latin1 &#8211;with-big-tables &#8211;without-debug<\/p>\n<p>$ make<br \/>\n$ make install<\/p>\n<p>$ cd \/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686<br \/>\n$ chown -R mysql .<br \/>\n$ chgrp -R mysql .<\/p>\n<p>\u6211\u4ee5\u524d\u5df2\u7ecf\u88c5\u8fc7MySQL5.5\u6240\u4ee5\u8fd9\u4e9b\u7528\u6237\u4ee5\u53ca\u7ec4\u90fd\u662f\u6709\u7684<\/p>\n<p>guohai@KNIGHT:~\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686$ sudo cp &#8216;\/home\/guohai\/dev\/src\/database\/mysql-5.1.57\/support-files\/my-medium.cnf&#8217; .\/my.cnf<\/p>\n<p>$ sudo bin\/mysql_install_db &#8211;user=mysql &#8211;basedir=\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686 &#8211;datadir=\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686\/data<\/p>\n<p>\u542f\u52a8\u6570\u636e\u5e93<br \/>\n$ sudo bin\/mysqld_safe &#8211;defaults-file=\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686\/my.cnf &#8211;user=mysql &#038;<br \/>\n\u6ce8\u610f\u8fd9\u4e2a\u53c2\u6570\u4f20\u9012\u7684\u987a\u5e8f\uff0c\u6211\u5f00\u59cb\u4e00\u76f4\u628a&#8211;user=mysql\u653e\u524d\u9762\uff0c\u542f\u52a8\u7684\u65f6\u5019\u62a5\u9519\uff0cMySQL\u65e5\u5fd7\u8bb0\u8f7dunknown variable &#8216;defaults-file&#8217;<br \/>\n110601 23:23:28 [ERROR] \/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686\/libexec\/mysqld: unknown variable &#8216;defaults-file=\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686\/my.cnf&#8217;<br \/>\n110601 23:23:28 [ERROR] Aborting<br \/>\n110601 23:23:28  InnoDB: Starting shutdown&#8230;<br \/>\n110601 23:23:33  InnoDB: Shutdown completed; log sequence number 0 44233<br \/>\n110601 23:23:33 [Note] \/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686\/libexec\/mysqld: Shutdown complete<\/p>\n<p>\u7136\u540e\u770b\u4e86mysqld_safe\u4e0b\u8fd9\u4e2a\u811a\u672c\u7684\u5199\u6cd5\uff0c\u53d1\u73b0\u5b83\u6709\u5bf9\u4f20\u5165\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u5224\u65ad\u662f\u5426\u4e3adefaults\uff0c\u4e8e\u662f\u6211\u5c31\u628adefaults-file\u8fd9\u4e2a\u53c2\u6570\u653e\u5230\u7b2c\u4e00\u4f4d\uff0c\u5c31\u6b63\u5e38\u542f\u52a8\u4e86<\/p>\n<p>\u4e00\u5207\u90fd\u597d\u4e86\uff0c\u7136\u540e\u5c31\u662f\u8bbe\u7f6e\u4e86<br \/>\n\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686$ sudo bin\/mysql_secure_installation<br \/>\n\u4e00\u6b65\u6b65\u6765\u5c31\u597d\u4e86\uff0c\u6ce8\u610f\u9ed8\u8ba4my.cnf\u7684\u4f4d\u7f6e\uff0c\u6211\u7684\u5c31\u653e\u5728mysql-5.1.57\u5b89\u88c5\u76ee\u5f55\u4e0b<\/p>\n<p>\u53ef\u80fd\u8fd8\u8981\u4fee\u6539\u4e0bMySQL\u6570\u636e\u6587\u4ef6\u5b58\u653e\u7684\u8def\u5f84\uff0c\u6211\u6700\u5f00\u59cb\u7f16\u8bd1\u7684\u65f6\u5019\u6ca1\u6709\u6307\u5b9a\uff0c\u7136\u540e\u5b83\u5e2e\u6211\u751f\u6210\u7684\u662f\u653e\u5728mysql-5.1.57\u5b89\u88c5\u76ee\u5f55\u7684\u4e00\u4e2avar\u76ee\u5f55\u4e0b\u9762\u7684\uff0c\u800c\u6211\u5728my.cnf\u4e2d\u6307\u5b9a\u7684\u662fdata\u76ee\u5f55<br \/>\n\u6240\u4ee5\u6211\u5c31\u4fee\u6539\u4e86\u4e00\u4e2a\u811a\u672c\u4e2d\u7684\uff0c\u628avar\u6539\u4e3adata\u4e86\uff0c\u5177\u4f53\u662f\u54ea\u4e2a\u811a\u672c\u5fd8\u8bb0\u4e86<\/p>\n<p>\u518d\u91cd\u542f\u4e0b\uff0c\u5c31\u53ef\u4ee5\u7528mysql\u547d\u4ee4\u8fde\u63a5\u4e0a\u53bb\u4e86\uff0c\u57fa\u672c\u6b63\u5e38<\/p>\n<p>MySQL\u7f16\u8bd1\u7b80\u5355\uff0c\u5173\u952e\u662f\u7f16\u8bd1\u51fa\u81ea\u5df1\u60f3\u8981\u7684MySQL\uff0c\u7f16\u8bd1\u51fa\u7b26\u5408\u81ea\u5df1\u4e1a\u52a1\u9ad8\u6027\u80fd\u7684MySQL\u5c31\u662f\u6280\u672f\u6d3b\u4e86\uff0c\u53c2\u6570\u5f88\u5173\u952e<br \/>\n\u53ea\u8981\u53c2\u6570\u7528\u7684\u597d\uff0c\u6ca1\u6709\u7a0b\u5e8f\u5199\u4e0d\u9e1f\uff1b\u53ea\u8981\u5de5\u5177\u7528\u7684\u597d\uff0c\u6ca1\u6709\u7a0b\u5e8f\u5199\u4e0d\u9e1f\uff1b\u5938\u5f20\u4e86\u70b9<\/p>\n<p>\u8fd8\u6709\u521a\u5f00\u59cb\u7f16\u8bd1\u51fa\u6765\u4f60\u53ef\u80fd\u627e\u4e0d\u5230mysqld\u8fd9\u4e2a\u4e1c\u897f\uff0c\u6211\u53cd\u6b63\u4e00\u5f00\u59cb\u662f\u6ca1\u6709\u627e\u5230\uff0c\u4ee5\u4e3a\u81ea\u5df1\u7f16\u8bd1\u7684\u51fa\u9519\u4e86\uff0c\u540e\u6765\u624d\u53d1\u73b0\u5728libexec\u4e0b\u800c\u4e0d\u662f\u5728bin\u4e0b\u9762\uff0c\u591a\u7528\u7528\u5de5\u5177\u641c\u7d22\u641c\u7d22\u5c31\u51fa\u6765\u4e86<\/p>\n<p>\u53e6\u5916\u4e5f\u53ef\u4ee5\u53c2\u89c1Ubuntu\u4e8c\u8fdb\u5236\u5b89\u88c5MySQL 5.5<br \/>\n\u5730\u5740http:\/\/lucane.iteye.com\/blog\/866355<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u8fd9\u4e48\u4e00\u4e2a\u573a\u666f\uff0c\u5355\u53f0MySQL\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u6700\u5927\u8868\u7ea6500\u4e07\u8bb0\u5f55\uff0c\u5e38\u7528\u8868100\u4e07\u8bb0\u5f55\uff0c\u6bcf\u884c\u8bb0\u5f55\u7684\u6570\u636e\u91cf\u4e0d\u662f\u5f88\u5927 \u67e5\u8be2\u8fd8\u7b97\u9891\u7e41\uff0c\u63d2\u5165\u4fee\u6539\u5220\u9664\u6570\u636e\u4e0d\u662f\u90a3\u4e48\u591a\uff0c\u591a\u4e2a\u5e94\u7528\u540c\u65f6\u8bbf\u95ee\u8fd9\u4e2a\u6570\u636e\u5e93 \u6709\u4e2a\u5e94\u7528\u5c31\u662f\u67e5\u8be2\u4e3a\u4e3b\uff0c\u6ca1\u6709\u4fee\u6539\uff0c\u5c11\u91cf\u7684\u5220\u9664 \u67e5\u8be2SQL\u8bed\u53e5\u5f88\u7b80\u5355\uff0c\u6839\u636e\u7528\u6237ID\u67e5\u8be2\u4ed6\u4e0b\u9762\u7684\u8bb0\u5f55\uff08\u67d0\u4e9b\u5b57\u6bb5\uff09\uff0c\u6839\u636e\u8bb0\u5f55ID\u67e5\u8be2\u6574\u6761\u8bb0\u5f55\uff0c\u4e24\u8868\u5173\u8054\u67e5\u8be2100\u4e07\u7684\u5173\u8054500\u4e07 \u76ee\u524d\u5e94\u7528\u7684\u5b9e\u73b0\u4e5f\u5f88\u7b80\u5355\uff0c\u7b80\u964b\u7684\u6570\u636e\u5e93\u8fde\u63a5\u6c60\uff0c\u5ba2\u6237\u7aef\u53d1\u9001SQL\u8bed\u53e5\u5230SQL\u670d\u52a1\u5668 \u73b0\u5728\u4e5f\u6ca1\u6709\u9047\u5230\u5f88\u5927\u7684\u95ee\u9898\uff0c\u6ca1\u6709\u5b95\u673a\u4ec0\u4e48\u7684\u95ee\u9898\uff0c\u4f46\u5c31\u662f\u5ba2\u6237\u7aef\u53cd\u6620\u6162\uff0c\u4f46\u662f\u770b\u670d\u52a1\u5668\u7684\u8d1f\u8f7d\u90fd\u4e0d\u662f\u5f88\u9ad8 \u6240\u4ee5\u8001\u5927\u5c31\u8bf4\u592a\u6162\u4e86\uff0c\u9700\u8981\u89e3\u51b3 \u8fd9\u4e2a\u6162\u662f\u6bd4\u8f83\u663e\u7136\u7684\u554a\uff0c\u6bcf\u6b21\u89e3\u6790\u6267\u884cSQL\u8bed\u53e5\uff0c\u7f51\u7edc\u4f20\u8f93\uff0c\u6570\u636e\u5e93\u670d\u52a1\u5668\u5185\u5b58\u8f83\u5c0f\uff0c\u7f13\u5b58\u4e0d\u591f \u6240\u4ee5\u5f53\u7136\u5c31\u60f3\u5230\u4e86\u5728\u5e94\u7528\u5c42\u52a0\u7f13\u5b58\uff0c\u4f46\u662f\u5728\u51e0\u4e2a\u6708\u4e4b\u524d\u66fe\u7ecf\u770b\u5230\u8fc7HandlerSocket\u7684\u7b80\u5355\u4ecb\u7ecd\uff0c\u53ea\u77e5\u9053\u5b83\u53ef\u4ee5\u52a0\u5feb\u67e5\u8be2\uff0c\u6ca1\u6709\u7ec6\u770b \u6240\u4ee5\u7a81\u7136\u89c9\u5f97\u76ee\u524d\u8fd9\u4e2a\u4e5f\u53ef\u4ee5\u6539\u7528HandlerSocket\uff0c\u800c\u4e14\u66f4\u5408\u9002\uff0c\u5411\u8001\u5927\u5efa\u8bae\uff0c\u5f53\u7136\u5efa\u8bae\u90fd\u662f\u6728\u6709\u7528\u7684\uff0c\u56e0\u4e3a\u6211\u505a\u4e0d\u9e1f\u4e3b\uff0c\u8001\u5927\u6709\u8001\u5927\u7684\u60f3\u6cd5 \u6240\u4ee5\u53ea\u80fd\u81ea\u5df1\u7814\u7a76\u770b\u770b\u8fd9\u4e2a\u4e1c\u897f\u9002\u5408\u4e0d\u4e86 \u4e8e\u662f\u5c31\u5f00\u59cb\u4e0b\u8f7d\u7f16\u8bd1\u5b89\u88c5\u8fd9\u4e2a\u4e1c\u897f\u4e86\uff0c\u6b65\u9aa4\u8fd8\u7b97\u7b80\u5355 \u5177\u4f53\u5b89\u88c5\u53c2\u89c1installation.en.txt \u6211\u5f00\u59cb\u60f3\u75285.1\u7684\u6e90\u7801\u548c5.5\u7684\u4e8c\u8fdb\u5236\u7248\u672c\u6df7\u5408\u7f16\u8bd1\uff08\u76ee\u524d\u6211\u81ea\u5df1\u7528\u76845.5\u7684MySQL\uff09\uff0c\u5929\u77e5\u9053\u80fd\u4e0d\u80fd\u6210\u529f\uff08\u6700\u540e\u662f\u4e0d\u80fd\u6210\u529f\u7684\uff0c\u6211\u53c8\u75285.1\u7684\u6e90\u7801\u91cd\u65b0\u7f16\u8bd1\u4e86\u4e00\u4e2aMySQL\u6570\u636e\u5e93\u51fa\u6765\uff0c\u7136\u540e\u7f16\u8bd1HandlerSocket\u5e76\u628a\u5b83\u5b89\u88c5\u52305.1\u4e2d\u4e86\uff0c\u540e\u6765\u770b\u5230\u4ecb\u7ecd\u662f\u6e90\u7801\u7248\u672c\u4e00\u5b9a\u8981\u548c\u5f53\u524d\u5b89\u88c5\u7684\u6570\u636e\u5e93\u7684\u7248\u672c\u4e00\u81f4\uff0c\u4e4b\u6240\u4ee5\u9700\u8981\u6e90\u7801\u662f\u56e0\u4e3aHandlerSocket\u63d2\u4ef6\u7528\u5230\u4e86MySQL\u6e90\u7801\u4e4b\u4e2d\u7684\u51e0\u4e2a\u5934\u6587\u4ef6\u4e4b\u7c7b\u7684\u5427\uff0c\u603b\u4e4b\u4e0d\u770bREADME\u662f\u5f88\u5934\u75bc\u7684\u3002\u6bd4\u5982\u6709\u7684\u9152\u5e97\u7684\u7535\u68af\u662f\u8981\u7528\u623f\u5361\u5237\u4e86\u7535\u68af\u4e4b\u540e\u624d\u80fd\u6309\u697c\u5c42\u7684\uff0cREADME\u5199\u7684\u6e05\u6e05\u695a\u695a\uff0c\u6c57\uff09 \u6211\u7684\u7f16\u8bd1\u6b65\u9aa4\u5982\u4e0b $ .\/autogen.sh $ .\/configure &#8211;with-mysql-source=\/home\/guohai\/dev\/src\/database\/mysql-5.1.57 &#8211;with-mysql-bindir=\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686\/bin &#8211;with-mysql-plugindir=\/home\/guohai\/dev\/a\/mysql\/mysql-5.1.57-linux2.6-i686\/lib\/mysql\/plugin $ make $ sudo make install mysql> install plugin handlersocket soname &#8216;handlersocket.so&#8217;; Query OK, 0 rows affected (0.03 sec) mysql> show plugins; +&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+ | Name | Status | Type | Library | License &hellip; <a href=\"https:\/\/guoh.ai\/lifelog\/2011\/06\/building-handler-socket-plugin-for-mysql\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u8bd5\u73a9HandlerSocket for MySQL<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_gfmr_meta_descriptions":[],"_gfmr_multilingual_taxonomy_terms":[],"footnotes":""},"categories":[13,6,8],"tags":[12],"class_list":["post-243","post","type-post","status-publish","format-standard","hentry","category-database","category-linux","category-paste","tag-mysql"],"_links":{"self":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/comments?post=243"}],"version-history":[{"count":3,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/243\/revisions"}],"predecessor-version":[{"id":266,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/243\/revisions\/266"}],"wp:attachment":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/media?parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/categories?post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/tags?post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}