2011-02-02

Tokyo Tyrant インストール

ソースコード取得。
  1. # cd /usr/local/src  
  2. # wget http://1978th.net/tokyocabinet/tokyocabinet-1.4.9.tar.gz  
  3. # wget http://1978th.net/tokyotyrant/tokyotyrant-1.1.40.tar.gz  
TokyoCabinetインストール。
  1. # tar zxvf ./tokyocabinet-1.4.9.tar.gz  
  2. # cd tokyocabinet-1.4.9  
  3. # ./configure  
  4. # make  
  5. # make install  
TokyoTyrantインストール。
  1. # tar zxvf tokyotyrant-1.1.40.tar.gz  
  2. # cd tokyotyrant-1.1.40  
  3. # ./configure  
  4. # make  
  5. # make install  
Tokyo Tyrantの起動スクリプトに以下を追加。
  1. # vi /usr/local/tokyotyrant/sbin/ttservctl  
  2.   
  3. # chkconfig: 345 65 55  
  4. # description: Startup script for the server of Tokyo Tyrant  
  5. # processname: tokyotyrant  
/etc/init.dにリンクを作ってchkconfigに登録&確認。
  1. # ln -s /usr/local/tokyotyrant/sbin/ttservctl /etc/init.d/  
  2. # chkconfig --add ttservctl  
  3. # chkconfig --list ttservctl  
  4. 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ごと再起動が掛かっても勝手に復活するようになります。
  1. # vi /etc/logrotate.d/tokyotyrant  
  2.     
  3. /home/ttserver/data/ttserver.log {  
  4.     monthly  
  5.     missingok  
  6.     rotate 12  
  7.     compress  
  8.     ifempty  
  9.     create  
  10.     sharedscripts  
  11.     postrotate  
  12.         /sbin/service ttservctl hup > /dev/null 2>/dev/null || true  
  13.     endscript  
  14. }  
参考サイト

0 件のコメント:

コメントを投稿