Official Website:
Http://fallabs.com/
Install tokyocabinet
./Configure -- prefix =/usr/local/tokyocabinet -- enable-off64
Make & make install
Install tokyotyrant
./Configure -- prefix =/usr/local/tokyotryrant -- with-tc =/usr/local/tokyocabinet/
Make & make install
Verify installation:
Run: #./ttservctl start in the tokyotyrant-1.1.41
# Telnet 127.0.0.1 1978 the default port is 1978. You can change the configuration in ttservctl.
[Ttserver] # curl-x put http: // 127.0.0.1: 1978/sky_key-d "sky"
Created
[Ttserver] # curl http: // 127.0.0.1: 1978/sky_key
Sky
You can modify ttservctl to achieve the desired startup mode.
Ttserver -- help
Ttserver: the server of Tokyo Tyrant
Usage:
Ttserver [-host name] [-port num] [-thnum num] [-tout num] [-dmn] [-pid path] [-kl] [-log path] [-ld |-le] [-ulog path] [-ulim num] [-uas] [-sid num] [-mhost name] [-mport num] [-rts path] [-rcc] [-skel name] [-mul num] [-ext path] [-extpc name period] [-mask expr] [-unmask expr] [dbname]
-Host name: Specifies the domain name or IP address of the server to be bound. All IP addresses on this server are bound by default.
-Port num: Specifies the port number to be bound. The default port is 1978.
-Thnum num: specifies the number of threads. The default value is 8 threads.
-Tout num: Specifies the timeout time (in seconds) for each session ). It never times out by default.
-Dmn: run as a daemon.
-Pid path: output process ID to the specified file (the file name is specified here ).
-Log path: Output log information to the specified file (the file name is specified here ).
-Ld: the DEBUG debugging information is also recorded in the log file.
-Le: only error information is recorded in the log file.
-Ulog path: Specifies the path for storing synchronization log files (the directory name is specified here ).
-Ulim num: Specifies the size of each synchronization log file.
-Uas: Update logs using asynchronous IO records (this option reduces disk IO consumption, but the data is first stored in the memory and will not be written to the disk immediately, if the restart server or ttserver process is killed, some data will be lost. It is generally not recommended ).
-Sid num: Specifies the server ID number (each ttserver needs a different ID number when active/standby mode is used)
-Mhost name: Specifies the domain name or IP address of the master server in master-slave synchronization mode.
-Mport num: Specifies the port number of the master server in master-slave synchronization mode.
-Rts path: Specifies the file name used to store the synchronization timestamp.
Some online startup methods include:
(1) standalone Mode
Ulimit-SHn 51200
Ttserver-host 127.0.0.1-port 11211-thnum 8-dmn-pid/ttserver. pid-log/ttserver. log-le-ulog/ttserver/-ulim 128 m-sid 1-rts/ttserver. rts/ttserver/database. tch
(2) Dual-Host Mode
Server 192.168.120.30:
Ulimit-SHn 51200
Ttserver-host 192.168.120.30-port 11211-thnum 8-dmn-pid/ttserver. pid-log/ttserver. log-le-ulog/ttserver/-ulim 128 m-sid 30-mhost 192.168.120.31-mport 11211-rts/ttserver. rts/ttserver/database. tch
Server 192.168.120.31:
Ulimit-SHn 51200
Ttserver-host 192.168.120.31-port 11211-thnum 8-dmn-pid/ttserver. pid-log/ttserver. log-le-ulog/ttserver/-ulim 128 m-sid 31-mhost 192.168.120.30-mport 11211-rts/ttserver. rts/ttserver/database. tch
Install the corresponding php Extension: tokyo_tyrant
. /Configure -- with-php-config =/usr/local/php5/bin/php-config -- with-tokyo-tyrant =/usr/local/tokyotryrant/-- with-tokyo- cabinet-dir =/usr/local/tokyocabinet/
Usage:
Http://cn2.php.net/manual/en/book.tokyo-tyrant.php
Download tokyocabinet
Download tokyotyrant