Yumで入れたMySQLにMroongaを導入する

YumでインストールしたMySQLにMroonga(MySQLストレージエンジン)を導入する。
OSはCentOS6.5、MySQLバージョンは5.6.21。
***

1. groonga(全文検索エンジン)をインストール
`# rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm`
`# yum install -y groonga groonga-tokenizer-mecab groonga-devel mecab-ipadic`
`# groonga --version
Groonga 6.0.4 [linux-gnu,x86_64,utf8,match-escalation-threshold=0,nfkc,mecab,mruby,onigmo,zlib,epoll]`
`configure options: < '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-static' '--with-package-platform=centos6' '--with-mecab' '--with-munin-plugins' '--enable-mruby' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'>`

2. MySQLのソースを取得
`# wget "http://pkgs.fedoraproject.org/repo/pkgs/community-mysql/mysql-5.6.21.tar.gz/e47c3a70b8d89db3199a349204b2ae4e/mysql-5.6.21.tar.gz" && tar zxf mysql-5.6.21.tar.gz`

3. Mroongaインストール
`# wget http://packages.groonga.org/source/mroonga/mroonga-6.03.tar.gz && tar zxf mroonga-6.03.tar.gz`
`# cd mroonga-6.03`
`# ./configure --with-mysql-source=/usr/local/src/mysql-5.6.21 --with-mysql-config=/usr/bin/mysql_config`
`# make && make install`

4. MySQLプラグイン追加
`mysql> INSTALL PLUGIN mroonga SONAME 'ha_mroonga.so';`

5. 確認
`mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| Mroonga            | YES     | CJK-ready fulltext search, column store                        | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
mysql> show variables like 'mroonga_version';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| mroonga_version | 6.03  |
+-----------------+-------+
1 row in set (0.00 sec)`

終わり