mroongaはmysql用全文検索エンジンです
mysqlのプラグインとしてインストールができます
CentOS6だと標準でインストールされているMySQL5.1でしかインストールが出来ないのでやきもきしていましたが色々試したら5.5にバージョンを上げることが出来たのでやったことを書いておきます
元々入っていたものを一旦削除
~~~
sudo yum remove php* mysql* mecab*
~~~
mecabをインストール
~~~
sudo yum -y install mecab mecab-devel mecab-ipadic –disablerepo=* –enablerepo=groonga
~~~
リポジトリを追加
~~~
cd /etc/yum.repo.d/
sudo wget http://wing-net.ddo.jp/wing/6/EL6.wing.repo
~~~
※ググって出てきた他の方法はうまくいきませんでした
mysql5.5のインストール
~~~
sudo yum –enablerepo=wing install mysql55-server
sudo service mysqld start
sudo yum –enablerepo=wing install mysql55-mroonga
~~~
スキーマをmysql5.5へアップグレード
~~~
mysql_upgrade -uroot -p
~~~
先にmroongaのinstallコマンドを実行してもmysql_upgradeすると消えちゃうようなので先に実行する
mroongaを有効にする
~~~
$ mysql -uroot -p
mysql> INSTALL PLUGIN mroonga SONAME ‘ha_mroonga.so’;
mysql> CREATE FUNCTION last_insert_grn_id RETURNS INTEGER soname ‘ha_mroonga.so’;
mysql> CREATE FUNCTION mroonga_snippet RETURNS STRING soname ‘ha_mroonga.so’;
mysql> CREATE FUNCTION mroonga_command RETURNS STRING soname ‘ha_mroonga.so’;
~~~
show enginesをした時にmroongaのSupportがYESになっていれば大丈夫
~~~
mysql> show engines;
+——————–+———+—————————————————————-+————–+——+————+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+——————–+———+—————————————————————-+————–+——+————+
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | 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 |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| mroonga | YES | CJK-ready fulltext search, column store | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
+——————–+———+—————————————————————-+————–+——+————+
10 rows in set (0.00 sec)
~~~
設定を反映するために再起動
~~~
sudo service mysqld restart
~~~
再起動に失敗した時はmysqld.logを見て起動しない原因を探る
PHPを入れなおす
~~~
sudo yum install –enablerepo=remi php php-common php-mysql php-devel php-pear php-mbstring php-gd php-pecl-apc
~~~
mysqlをremoveした時にpostfixも削除されているので入れなおすのを忘れないこと
mysql5.5で動きました
remiから入れたPHPとMySQL5.5の組み合わせで動くようになりました(´∀`)
~~~
$ mysql –version
mysql Ver 14.14 Distrib 5.5.30, for Linux (x86_64) using readline 5.1
~~~
コメント