Tuesday, November 9, 2010

Handlersocket for MySQL - ubuntu installation

Recently I've trapped on nice blog post of Yoshinori Matsunobu one of former developers of MySQL. He tells how to get a MySQL work as NoSQL. I've decided to compile that on my Ubuntu installation.

Getting sources

For building handlersocket under Ubuntu you will need to install
$ sudo aptitude install dpkg-dev libtool automake libssl-dev dpatch git-core
Create a directory where you will store all build files and get source of MySQL and handlersocket
$ mkdir build
$ cd build
$ sudo apt-get source mysql-server
$ git clone https://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL.git handlersocket

That will download MySQL source into mysql-dfsg-5.1-5.1.41 and handlersocket project into handlersocket directory.

Before you start

You need to apply some Debian patches and edit MySQL configure.in
$ cd mysql-dfsg-5.1-5.1.41
$ sudo dpatch apply-all

and in file configure.in you need to add a line
#([MySQL Server], 5.1.41)
Be sure you will add your MySQL version.

Compile handlersocket

Now you are ready to compile. $ cd ../handlersocket
$ ./configure --with-mysql-source=/path/to/mysql-dfsg-5.1-5.1.41 --with-mysql-bindir=/usr/bin/ --with-mysql-plugindir=/usr/lib/mysql/plugin/
$ make
$ sudo make install

if all wend goo you should see handlersocket.so in /usr/lib/mysql/plugin/ directory

Install handlersocket MySQL plugin

to run handlersocket you need to install MySQL plugin. Login as root to MySQL and execute following SQL query:
mysql> install plugin handlersocket soname 'handlersocket.so';
Query OK, 0 rows affected (0.05 sec)

To be sure you are have installed plugin you should check show processlist; If you saw a message about permission denied or so - you need to turn off apparmor while installing plugin.
$ sudo invoke-rc.d apparmor stop

References

Github project page

No comments:

Post a Comment