Tokyo Cabinet & Tokyo Tyrant 安装

 

安装步骤:

1.安装依赖包

sudo yum -y install gcc gcc-c++ autoconf apr  apr-util libjpeg libjpeg-devel libtool libpng libpng-devel freetype 
freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel 
ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel  libidn libidn-devel 
openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
sudo yum install zlib* make*
sudo yum install bzip* make*

2.下载

mkdir -p /home/q/nosql
wget http://fallabs.com/tokyocabinet/tokyocabinet-1.4.47.tar.gz
wget http://fallabs.com/tokyotyrant/tokyotyrant-1.1.41.tar.gz

3.安装

注意:注意粗体字体的内容

cd /home/q/nosql

tar zxvf tokyocabinet-1.4.47.tar.gz
cd tokyocabinet-1.4.47
sudo ./configure --prefix=/home/q/nosql/tc1.4.47
sudo make
sudo make install

tar zxvf tokyotyrant-1.1.41.tar.gz
cd tokyotyrant-1.1.41
sudo ./configure --prefix=/home/q/nosql/tt1.1.41  --with-tc=/home/q/nosql/tc1.4.47
sudo make
sudo make install

4.启动

该方式不推荐。目前采用ttservctl启动。

单机启动:

sudo ./ttserver \
    -host localhost \
    -port 1978 \
    -thnum 8 \
    -dmn \
    -pid /home/q/nosql/instance/default/ttserver.pid \
    -log /home/q/nosql/instance/default/ttserver.log \
    -le \
    -ulog /home/q/nosql/instance/default/ \
    -ulim 128m\
    -rts /home/q/nosql/instance/default/ttserver.rts /home/q/nosql/instance/default/database.tch

双机互备:

ttserver \
    -host localhost \
    -port 1978 \
    -thnum 8 \
    -dmn \
    -pid /home/tom/t1/ttserver.pid \
    -log /home/tom/t1/ttserver.log \
    -le \
    -ulog /home/tom/t1/ \
    -ulim 128m \
    -sid 100 \
    -mhost localhost \
    -mport 1979 \
    -rts /home/tom/t1/ttserver.rts /home/tom/t1/database.tch

5.测试

# 插入
tom@debian:~$ curl -X PUT http://127.0.0.1:1978/key -d "value"
# 读取
tom@debian:~$ curl http://127.0.0.1:1978/key
# 删除
tom@debian:~$ curl -X DELETE http://127.0.0.1:1978/key

 

你可能感兴趣的:(Tokyo Cabinet)