Sunday, March 29, 2009

MySQL :: Compiling the skeleton engine

From MySQL-5.1 there is support for pluggable storage engine. Here we will learn how to compile and use a skeleton engine.
First you need to have MySQL installed in your system. For installing follow this link

Now get the latest version of the skeleton engine. You will get it here
http://hg.tangent.org/skeleton-mysql-engine?ca=tip;type=gz

Now Step 1 untar and uncompress the file.

Now cd to this directory. You will see there is no configure file. Step 2 to generate on do the following

[root@localhost skeleton-mysql-engine-0beed5ef2859]# sh config/bootstrap+ '[' -f /usr/bin/glibtoolize ']'
+ LIBTOOLIZE=libtoolize
+ aclocal
+ autoheader
+ libtoolize --automake --force
+ automake --add-missing --force
configure.in:5: installing `config/missing'
configure.in:5: installing `config/install-sh'
src/Makefile.am: installing `config/depcomp'
Makefile.am: installing `./INSTALL'
+ autoconf

Now Step 3 is to configure

[root@localhost skeleton-mysql-engine-0beed5ef2859]# ./configure --with-mysql=/root/Desktop/mysql-5.1.30/ --libdir=/usr/local/mysql-5.1.30/lib/mysql/

Here the --with-mysql should be pointed to a source tree for MySQL. The --libdir can be used to say which lib directory the plugin should be installed in once it is compiled.

Now Step 4 is to just make, make install.

[root@localhost skeleton-mysql-engine-0beed5ef2859]# make
[root@localhost skeleton-mysql-engine-0beed5ef2859]# make install

Now start mysql and connect to it. Then Step 5 is to load it.

mysql> INSTALL PLUGIN skeleton SONAME 'libskeleton_engine.so';
Query OK, 0 rows affected (0.01 sec)

You can see all the storage engines.

mysql> show plugins;
+------------+--------+----------------+-----------------------+---------+
| Name | Status | Type | Library | License |
+------------+--------+----------------+-----------------------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| SKELETON | ACTIVE | STORAGE ENGINE | libskeleton_engine.so | BSD |
+------------+--------+----------------+-----------------------+---------+
6 rows in set (0.00 sec)

See,you have loaded your first storage engine.

No comments: