2011-02-02

Tokyo Tyrant インストール

ソースコード取得。
# cd /usr/local/src
# wget http://1978th.net/tokyocabinet/tokyocabinet-1.4.9.tar.gz
# wget http://1978th.net/tokyotyrant/tokyotyrant-1.1.40.tar.gz
TokyoCabinetインストール。
# tar zxvf ./tokyocabinet-1.4.9.tar.gz
# cd tokyocabinet-1.4.9
# ./configure
# make
# make install
TokyoTyrantインストール。
# tar zxvf tokyotyrant-1.1.40.tar.gz
# cd tokyotyrant-1.1.40
# ./configure
# make
# make install
Tokyo Tyrantの起動スクリプトに以下を追加。
# vi /usr/local/tokyotyrant/sbin/ttservctl

# chkconfig: 345 65 55
# description: Startup script for the server of Tokyo Tyrant
# processname: tokyotyrant
/etc/init.dにリンクを作ってchkconfigに登録&確認。
# ln -s /usr/local/tokyotyrant/sbin/ttservctl /etc/init.d/
# chkconfig --add ttservctl
# chkconfig --list ttservctl
ttservctl       0:off   1:off   2:off   3:on    4:on    5:on    6:off

logrotateに登録。
/home/ttserver/data/ttserver.logにTokyo Tyrantのログが書き出されますが、放置しておくと肥大化します。
そのため、ログをローテーションする仕組みに任せてます。
Tokyo Tyrantの起動停止スクリプトがHUPをフォローしてくれているので、これだけでOK。
ここまでやっておけば、永続化機能のついた、OSごと再起動が掛かっても勝手に復活するようになります。
# vi /etc/logrotate.d/tokyotyrant
  
/home/ttserver/data/ttserver.log {
    monthly
    missingok
    rotate 12
    compress
    ifempty
    create
    sharedscripts
    postrotate
        /sbin/service ttservctl hup > /dev/null 2>/dev/null || true
    endscript
}
参考サイト

0 件のコメント:

コメントを投稿