1
1. Building Handlersocket
3
Handlersocket mainly consists of libhsclient, handlersocket, and C++/Perl clients. libhsclient is a common library shared from both client and server(plugin). handlersocket is a MySQL daemon plugin.
4
To build Handlersocket, you need both MySQL source code and MySQL binary. It is not required to pre-build MySQL source code, but source itself is needed because Handlersocket depends on MySQL header files that only MySQL source distribution contains. MySQL binary is just a normal MySQL binary distribution. You can use official MySQL binaries provided by Oracle.
5
Since Handlersocket uses daemon plugin interface supported from MySQL 5.1,
6
MySQL 5.1 or higher version is required.
7
Please make sure that you use identical MySQL version between MySQL source
8
and MySQL binary. Otherwise you might encounter serious problems (i.e. server
10
Here are steps to build Handlersocket.
12
* Get MySQL source code
18
$ ./configure --with-mysql-source=/work/mysql-5.1.50 --with-mysql-bindir=/work/mysql-5.1.50-linux-x86_64-glibc23/bin --with-mysql-plugindir=/work/mysql-5.1.50-linux-x86_64-glibc23/lib/plugin
20
--with-mysql-source refers to the top of MySQL source directory,
21
--with-mysql-bindir refers to where MySQL binary executables (i.e.
22
mysql_config) are located, and --with-mysql-plugindir refers to a plugin
23
directory where plugin libraries (*.so) are installed.
28
Both libhsclient and the handlersocket plugin will be installed.
31
2. Using Handlersocket
33
Append configuration options for handlersocket to my.cnf.
36
loose_handlersocket_port = 9998
37
# the port number to bind to (for read requests)
38
loose_handlersocket_port_wr = 9999
39
# the port number to bind to (for write requests)
40
loose_handlersocket_threads = 16
41
# the number of worker threads (for read requests)
42
loose_handlersocket_threads_wr = 1
43
# the number of worker threads (for write requests)
44
open_files_limit = 65535
45
# to allow handlersocket accept many concurrent
46
# connections, make open_files_limit as large as
49
Log in to mysql as root, and execute the following query.
51
mysql> install plugin handlersocket soname 'handlersocket.so';
53
If handlersocket.so is successfully installed, it starts
54
accepting connections on port 9998 and 9999. Running
55
'show processlist' should show handlersocket worker threads.
57
-----------------------------------------------------------------
58
On the client side, you need to install libhsclient for c++ apps
59
and perl-Net-HandlerSocket for perl apps. They do not require
63
$ ./configure --disable-handlersocket-server
66
$ cd perl-Net-HandlerSocket
71
-----------------------------------------------------------------
72
Alternatively, you can use the rpm installation. If your OS
73
supports rpms, you can use the following commands to build and
74
install handlersocket rpm packages.
76
(Server side, installs HandlerSocket plugin)
78
$ ./configure --with-mysql-source=/work/mysql-5.1.50 --with-mysql-bindir=/work/mysql-5.1.50-linux-x86_64-glibc23/bin --with-mysql-plugindir=/work/mysql-5.1.50-linux-x86_64-glibc23/lib/plugin
80
$ sudo rpm -U dist/RPMS/*/libhsclient*.rpm
82
$ sudo rpm -U dist/RPMS/*/handlersocket*.rpm
84
(Client side, installs client libraries)
86
$ ./configure --disable-handlersocket-server
88
$ sudo rpm -U dist/RPMS/*/libhsclient*.rpm
90
$ sudo rpm -U dist/RPMS/*/perl-Net-HandlerSocket*.rpm