TokyoTyrantを仕事で使うことになったのでインストール方法をメモ。

  • OSはCentOS5.4
  • TokyoTyrantのバージョンは1.1.40

まず、yumで必要なパッケージをインストール。

$ yum install gcc make zlib-devel bzip2-devel

次にTokyoTyrantが依存するTokyoCabinetをインストール

$ wget http://1978th.net/tokyocabinet/tokyocabinet-1.4.43.tar.gz

$ tar xvfz tokyocabinet-1.4.43.tar.gz

$ cd tokyocabinet-1.4.43

$ ./configure
   .
   .
   .
#================================================================
# Ready to make.
#================================================================

$ make
   .
   .
   .
#================================================================
# Ready to install.
#================================================================

$ make install
mkdir -p /usr/local/include
cp -Rf tcutil.h tchdb.h tcbdb.h tcfdb.h tctdb.h tcadb.h /usr/local/include
mkdir -p /usr/local/lib
cp -Rf libtokyocabinet.a libtokyocabinet.so.9.6.0 libtokyocabinet.so.9 libtokyocabinet.so /usr/local/lib
mkdir -p /usr/local/bin
cp -Rf tcutest tcumttest tcucodec tchtest tchmttest tchmgr tcbtest tcbmttest tcbmgr tcftest tcfmttest tcfmgr tcttest tctmttest tctmgr tcatest tcamttest tcamgr /usr/local/bin
mkdir -p /usr/local/libexec
cp -Rf tcawmgr.cgi /usr/local/libexec
mkdir -p /usr/local/share/tokyocabinet
cp -Rf COPYING ChangeLog THANKS doc tokyocabinet.idl /usr/local/share/tokyocabinet
mkdir -p /usr/local/share/man/man1
cd man && cp -Rf tcutest.1 tcumttest.1 tcucodec.1 tchtest.1 tchmttest.1 tchmgr.1 tcbtest.1 tcbmttest.1 tcbmgr.1 tcftest.1 tcfmttest.1 tcfmgr.1 tcttest.1 tctmttest.1 tctmgr.1 tcatest.1 tcamttest.1 tcamgr.1 /usr/local/share/man/man1
mkdir -p /usr/local/share/man/man3
cd man && cp -Rf tokyocabinet.3 tcutil.3 tcxstr.3 tclist.3 tcmap.3 tctree.3 tcmdb.3 tcmpool.3 tchdb.3 tcbdb.3 tcfdb.3 tctdb.3 tcadb.3 /usr/local/share/man/man3
mkdir -p /usr/local/lib/pkgconfig
cp -Rf tokyocabinet.pc /usr/local/lib/pkgconfig
[ "$UID" == 0 ] && ldconfig || true

#================================================================
# Thanks for using Tokyo Cabinet.
#================================================================

TokyoCabinetをインストール

$ wget http://1978th.net/tokyotyrant/tokyotyrant-1.1.40.tar.gz

$ tar xvfz tokyotyrant-1.1.40.tar.gz

$ cd tokyotyrant-1.1.40

$ ./configure
   .
   .
   .
#================================================================
# Ready to make.
#================================================================

$ make
   .
   .
   .
#================================================================
# Ready to install.
#================================================================

$ make install
mkdir -p /usr/local/include
cp -Rf ttutil.h tculog.h tcrdb.h /usr/local/include
mkdir -p /usr/local/lib
cp -Rf libtokyotyrant.a libtokyotyrant.so.3.23.0 libtokyotyrant.so.3 libtokyotyrant.so ttskelmock.so ttskeldir.so ttskelproxy.so ttskelnull.so /usr/local/lib
mkdir -p /usr/local/bin
cp -Rf ttserver ttulmgr ttultest tcrtest tcrmttest tcrmgr /usr/local/bin
mkdir -p /usr/local/sbin
cp -Rf ttservctl /usr/local/sbin
mkdir -p /usr/local/share/tokyotyrant
cp -Rf ext COPYING ChangeLog THANKS doc /usr/local/share/tokyotyrant
mkdir -p /usr/local/share/man/man1
cd man && cp -Rf ttserver.1 ttulmgr.1 ttultest.1 tcrtest.1 tcrmttest.1 tcrmgr.1 /usr/local/share/man/man1
mkdir -p /usr/local/share/man/man3
cd man && cp -Rf ttutil.3 tculog.3 tcrdb.3 /usr/local/share/man/man3
mkdir -p /usr/local/share/man/man8
cd man && cp -Rf ttservctl.8 /usr/local/share/man/man8
mkdir -p /usr/local/lib/pkgconfig
cp -Rf tokyotyrant.pc /usr/local/lib/pkgconfig

#================================================================
# Thanks for using Tokyo Tyrant.
#================================================================

動かしてみる。

$ ttserver
2010-03-18T03:01:12+09:00       SYSTEM  --------- logging started [8932] --------
2010-03-18T03:01:12+09:00       SYSTEM  server configuration: host=(any) port=1978
2010-03-18T03:01:12+09:00       SYSTEM  maximum connection: 1048575
2010-03-18T03:01:12+09:00       SYSTEM  opening the database: *
2010-03-18T03:01:12+09:00       SYSTEM  service started: 8932
2010-03-18T03:01:12+09:00       INFO    timer thread 1 started
2010-03-18T03:01:12+09:00       INFO    worker thread 1 started
2010-03-18T03:01:12+09:00       INFO    worker thread 2 started
2010-03-18T03:01:12+09:00       INFO    worker thread 3 started
2010-03-18T03:01:12+09:00       INFO    worker thread 4 started
2010-03-18T03:01:12+09:00       INFO    worker thread 5 started
2010-03-18T03:01:12+09:00       INFO    worker thread 6 started
2010-03-18T03:01:12+09:00       INFO    worker thread 7 started
2010-03-18T03:01:12+09:00       INFO    worker thread 8 started
2010-03-18T03:01:12+09:00       SYSTEM  listening started
^Z
[1]+  Stopped                 ttserver
$ bg
[1]+ ttserver &
$

うまく動いてるかチェック。

$ make check
LD_LIBRARY_PATH=.:/lib:/usr/lib:/usr/local/lib:/root/lib:/usr/local/lib:/usr/local/lib  ./tcrmgr version
Tokyo Tyrant version 1.1.40 (323:0.91) for Linux
Copyright (C) 2007-2010 Mikio Hirabayashi
LD_LIBRARY_PATH=.:/lib:/usr/lib:/usr/local/lib:/root/lib:/usr/local/lib:/usr/local/lib  ./tcrtest write -cnum 5 -tout 5 -rnd 127.0.0.1 50000

host=127.0.0.1  port=1978  cnum=5  tout=5  rnum=50000  nr=0  rnd=1

2010-03-18T03:01:33+09:00       INFO    connected: 127.0.0.1:48972
2010-03-18T03:01:33+09:00       INFO    connected: 127.0.0.1:48973
2010-03-18T03:01:33+09:00       INFO    connected: 127.0.0.1:48974
2010-03-18T03:01:33+09:00       INFO    connected: 127.0.0.1:48975
2010-03-18T03:01:33+09:00       INFO    connected: 127.0.0.1:48976
......................... (00005000)
......................... (00010000)
......................... (00015000)
......................... (00020000)
......................... (00025000)
......................... (00030000)
.
.
.
......................... (00004500)
......................... (00005000)
..........time: 1.181
ok

#================================================================
# Checking completed.
#================================================================

良いみたいです。

おしまい。

参考URL


2件のコメント

CFD tokyoについての調査結果 « CFD研究blog · 2010-10-12 06:54

[…] TokyoTyrantをCentOS5.4にインストールする方法 « 来栖川電算tcbdb.h tcfdb.h tctdb.h tcadb.h /usr/local/include mkdir -p /usr/local/lib cp -rf libtokyocabinet.a libtokyocabinet.so.9.6.0 libt…はてなブックマークより […]

現在コメントは受け付けていません。