If you’re interested in screaming fast, persistent key-value stores, you should consider Tokyo Cabinet. If you want to talk to your Tokyo Cabinet machine over a network, you will need Tokyo Tyrant. In this installation article I’m going to walk through the installation of Tokyo Cabinet version 1.4.23 and Tokyo Tyrant version 1.1.27 on MacOS X.
Tokyo Cabinet & Tokyo Tyrant in a Single Line
The easiest way to install both Tokyo Cabinet and Tokyo Tyrant is to use MacPorts.
Trinity:~ kelvin$ sudo port install tokyocabinet tokyotyrant
Password:
---> Fetching tokyocabinet
---> Attempting to fetch tokyocabinet-1.4.23.tar.gz from http://superb-west.dl.sourceforge.net/tokyocabinet
---> Verifying checksum(s) for tokyocabinet
---> Extracting tokyocabinet
---> Configuring tokyocabinet
---> Building tokyocabinet
---> Staging tokyocabinet into destroot
---> Installing tokyocabinet @1.4.23_0
---> Activating tokyocabinet @1.4.23_0
---> Cleaning tokyocabinet
---> Fetching tokyotyrant
---> Attempting to fetch tokyotyrant-1.1.27.tar.gz from http://superb-west.dl.sourceforge.net/tokyocabinet
---> Verifying checksum(s) for tokyotyrant
---> Extracting tokyotyrant
---> Configuring tokyotyrant
---> Building tokyotyrant
---> Staging tokyotyrant into destroot
---> Installing tokyotyrant @1.1.27_0
---> Activating tokyotyrant @1.1.27_0
---> Cleaning tokyotyrant
Trinity:~ kelvin$
So that was pretty easy. Now run the tests to check our installation.
Testing
Let’s see if the Tokyo Tyrant can be started. Once started, it can be stopped using Ctrl-C.
Trinity:~ kelvin$ ttserver
2009-06-01T18:32:43-08:00 SYSTEM --------- logging started [13738] --------
2009-06-01T18:32:43-08:00 SYSTEM server configuration: host=(any) port=1978
2009-06-01T18:32:43-08:00 SYSTEM opening the database: *
2009-06-01T18:32:43-08:00 SYSTEM service started: 13738
2009-06-01T18:32:43-08:00 INFO timer thread 1 started
2009-06-01T18:32:43-08:00 INFO worker thread 1 started
2009-06-01T18:32:43-08:00 INFO worker thread 2 started
2009-06-01T18:32:43-08:00 INFO worker thread 3 started
2009-06-01T18:32:43-08:00 INFO worker thread 4 started
2009-06-01T18:32:43-08:00 INFO worker thread 5 started
2009-06-01T18:32:43-08:00 INFO worker thread 6 started
2009-06-01T18:32:43-08:00 INFO worker thread 7 started
2009-06-01T18:32:43-08:00 INFO worker thread 8 started
2009-06-01T18:32:43-08:00 SYSTEM listening started
^C
2009-06-01T18:33:14-08:00 INFO signal interruption
2009-06-01T18:33:14-08:00 SYSTEM listening finished
2009-06-01T18:33:14-08:00 SYSTEM closing the database
2009-06-01T18:33:14-08:00 INFO worker thread 1 was canceled
2009-06-01T18:33:14-08:00 INFO worker thread 1 finished
2009-06-01T18:33:14-08:00 INFO worker thread 2 was canceled
2009-06-01T18:33:14-08:00 INFO worker thread 2 finished
2009-06-01T18:33:14-08:00 INFO worker thread 3 was canceled
2009-06-01T18:33:14-08:00 INFO worker thread 3 finished
2009-06-01T18:33:14-08:00 INFO worker thread 4 was canceled
2009-06-01T18:33:14-08:00 INFO worker thread 4 finished
2009-06-01T18:33:14-08:00 INFO worker thread 5 was canceled
2009-06-01T18:33:14-08:00 INFO worker thread 5 finished
2009-06-01T18:33:14-08:00 INFO worker thread 6 was canceled
2009-06-01T18:33:14-08:00 INFO worker thread 6 finished
2009-06-01T18:33:14-08:00 INFO worker thread 7 was canceled
2009-06-01T18:33:14-08:00 INFO worker thread 7 finished
2009-06-01T18:33:14-08:00 INFO worker thread 8 was canceled
2009-06-01T18:33:14-08:00 INFO worker thread 8 finished
2009-06-01T18:33:14-08:00 INFO timer thread 1 was canceled
2009-06-01T18:33:14-08:00 INFO timer thread 1 finished
2009-06-01T18:33:14-08:00 SYSTEM service finished
2009-06-01T18:33:14-08:00 SYSTEM --------- logging finished [13738] --------
Trinity:~ kelvin$
If you can start and stop your Tyrant then you are halfway there. Let’s try one more test using the testing program supplied. Our first command starts the server in the background (so we can do more work in a single terminal window) and returns a process id (13779 in the example). We will use the process id to stop the server later so make note of it. We will then use the tcrtest program to test it.
Trinity:~ kelvin$ ttserver 1>/dev/null &
[1] 13779
Trinity:~ kelvin$ tcrtest misc localhost 1000
<Miscellaneous Test>
host=localhost port=1978 cnum=1 tout=0 rnum=1000
writing:
......................... (00000100)
......................... (00000200)
......................... (00000300)
......................... (00000400)
......................... (00000500)
......................... (00000600)
......................... (00000700)
......................... (00000800)
......................... (00000900)
......................... (00001000)
reading:
......................... (00000100)
......................... (00000200)
......................... (00000300)
......................... (00000400)
......................... (00000500)
......................... (00000600)
......................... (00000700)
......................... (00000800)
......................... (00000900)
......................... (00001000)
random writing:
......................... (00000100)
......................... (00000200)
......................... (00000300)
......................... (00000400)
......................... (00000500)
......................... (00000600)
......................... (00000700)
......................... (00000800)
......................... (00000900)
......................... (00001000)
word writing:
.................... (00000041)
random erasing:
......................... (00000100)
......................... (00000200)
......................... (00000300)
......................... (00000400)
......................... (00000500)
......................... (00000600)
......................... (00000700)
......................... (00000800)
......................... (00000900)
......................... (00001000)
writing:
......................... (00000100)
......................... (00000200)
......................... (00000300)
......................... (00000400)
......................... (00000500)
......................... (00000600)
......................... (00000700)
......................... (00000800)
......................... (00000900)
......................... (00001000)
erasing:
......................... (00000100)
......................... (00000200)
......................... (00000300)
......................... (00000400)
......................... (00000500)
......................... (00000600)
......................... (00000700)
......................... (00000800)
......................... (00000900)
......................... (00001000)
random multi reading:
......................... (00000100)
......................... (00000200)
......................... (00000300)
......................... (00000400)
......................... (00000500)
......................... (00000600)
......................... (00000700)
......................... (00000800)
......................... (00000900)
......................... (00001000)
script extension calling:
......................... (00000100)
......................... (00000200)
......................... (00000300)
......................... (00000400)
......................... (00000500)
......................... (00000600)
......................... (00000700)
......................... (00000800)
......................... (00000900)
......................... (00001000)
checking versatile functions:
......................... (00000100)
......................... (00000200)
......................... (00000300)
......................... (00000400)
......................... (00000500)
......................... (00000600)
......................... (00000700)
......................... (00000800)
......................... (00000900)
......................... (00001000)
record number: 0
size: 262688
time: 1.700
ok
Trinity:~ kelvin$ kill 13779
Trinity:~ kelvin$