mroongaインストールのまとめ

参考サイト
http://memocra.blogspot.jp/2013/05/mroonga-mroongamysql.html

AWSにインストールしました

■mysql5.5をアンインストール

yum remove mysql
yum remove mysql-server
yum remove mysql-libs

■ビルドに必要なものをインストール

yum install cmake
yum install -y ncurses
yum install -y ncurses-devel
yum install -y gcc-c++
yum install -y bison

■mysql5.6をインストール

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz
tar mysql-5.6.17.tar.gz
cd mysql-5.6.17

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=true -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=OFF
make
make install

mysql5.6のインストール完了！

■confの設定
sudo cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
confは下記にしておく(とりあえず)
<pre>
[client]
port  = 3306
socket  = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
port  = 3306
socket  = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 8
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
innodb_data_home_dir = /usr/local/mysql/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_file_per_table
innodb_fast_shutdown = 0
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
</pre>

■mysqlユーザ・グループの作成
groupadd mysql
useradd -g mysql -d /bin/false mysql

■mysql_install_db を実行
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

■起動の設定
vi /root/.bash_profile

<pre>
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
 . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/mysql/bin

export PATH
</pre>

source ~/.bash_profile
sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
sudo /etc/init.d/mysql start

■groongaのインストール

rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
yum makecache
sudo yum --enablerepo=groonga install -y mecab
sudo yum --enablerepo=groonga install -y mecab-ipadic
sudo yum --enablerepo=groonga install -y groonga
sudo yum --enablerepo=groonga install -y groonga-tokenizer-mecab
sudo yum --enablerepo=groonga install -y groonga-normalizer-mysql
sudo yum --enablerepo=groonga install -y groonga-devel

■mroongaのインストール

yumでのmroongaはmysql5.1に依存するので
mysql5.5ではソースからmroongaをインストールする

sudo yum install -y automake
cd /usr/local/src/
sudo curl -OL http://packages.groonga.org/source/mroonga/mroonga-4.02.tar.gz
sudo tar xzvf mroonga-4.02.tar.gz
cd mroonga-4.0.2
sudo ./configure --with-mysql-source=/usr/local/src/mysql-5.6.17 --with-mysql-config=/usr/local/mysql/bin/mysql_config
sudo make
sudo make install