For details about Tokyo cabinet and Tokyo tyrant, Google. The following describes how to install Tokyo cabinet and Tokyo tyrant. if the version you have installed is different, modify the corresponding installation command based on the version:
1. Compile and install the tokyocabinet database.
Wget http://tokyocabinet.sourceforge.net/tokyocabinet-1.3.22.tar.gz
Tar zxvf tokyocabinet-1.3.22.tar.gz
CD tokyocabinet-1.3.22/
./Configure
Make
Make install
CD ../
2. Compile and install tokyotyrant.
Wget http://tokyocabinet.sourceforge.net/T... Tokyotyrant-1.1.8.tar.gz
Tar zxvf tokyotyrant-1.1.8.tar.gz
CD tokyotyrant-1.1.8/
./Configure
Make
Make install
CD ../
Ii. Configuration
1. Create a tokyotyrant data file storage directory
Mkdir-P/ttserver/
2. Start the main process (ttserver) of tokyotyrant)
(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.1.91:
Ulimit-shn 51200
Ttserver-host 192.168.1.91-port 11211-thnum 8-DMN-PID
/Ttserver. PID-log/ttserver. Log-le-ulog/ttserver/
-Ulim 128 M-Sid 91-mhost 192.168.1.92-mport 11211-RTS
/Ttserver. RTS/ttserver/database. Tch
Server 192.168.1.92:
Ulimit-shn 51200
Ttserver-host 192.168.1.92-port 11211-thnum 8-DMN-PID
/Ttserver. PID-log/ttserver. Log-le-ulog/ttserver/
-Ulim 128 M-Sid 92-mhost 192.168.1.91-mport 11211-RTS
/Ttserver. RTS/ttserver/database. Tch
(3) parameter description
Ttserver [-host name] [-port num] [-thnum num] [-Tout num] [-DMN]
[-Pid path] [-Log Path] [-LD |-le] [-ulog path] [-ulim num] [-UAS] [-Sid
Num] [-mhost name] [-mport num] [-RTS path] [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 (for example, 128 MB ).
-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.
If a hash database is used, you can specify the parameter "# bnum = xxx" to improve performance. It can specify the number of buckets. For example, if "# bnum = 1000000" is specified, the latest and most popular 1 million records can be cached in the memory:
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 # bnum = 1000000
If a large number of clients access ttserver, ensure that the file descriptor is sufficient. The default file descriptor of many servers is 1024. You can use the ulimit command to increase this value before starting ttserver. For example:
Ulimit-shn 51200
3. Stop tokyotyrant (ttserver)
PS-Ef | grep ttserver
Locate the process ID of the ttserver and kill it. For example:
Kill-term 2159