安装配置ttserver(tokyocabinet,Tokyo Tyrant)
时间:2009-08-21
来源:互联网
本文原创,作者:python中国--老老仙 http://www.okpython.com/bbs
准备软件:
tokyocabinet,Tokyo Tyrant
关联软件,bzip2:
wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz
如果不安装的话,在你配置tc,tt的时候,就会报告一个bzip2.h 未定义(bzip2.h no required)的错误信息.
先安装bzip,简单看了下英文文档,里面说只要make install就可以安装了,无需configure,如果需要设定安装配置路径,可以在后面加上--prefix
如:make install prefix=/usr/local/...
OK,一切正常。
接着下载tc(tokyocabinet)
网上的一些文章提到http://tokyocabinet.sourceforge.net/下载,但是下载下来的文件缺少,所以我又花时间找到了一个可信的下载地址:
wget http://blog.s135.com/soft/linux/ ... abinet-1.3.1.tar.gz
wget http://sourceforge.net/projects/ ... .30.tar.gz/download
然后解压,
tar zvxf tokyocabinet-1.4.30.tar.gz
./configure --prefix=/usr/local/tc/
cd tokyocabinet-1.4.30
make && make inistall
一切顺利,继续:
现在安装ttserver了。
wget http://sourceforge.net/projects/ ... .33.tar.gz/download
cd tokyotyrant-1.1.33
./configure --prefix=/usr/local/ttserver/
最后出现了一个错误,看来还是有关联软件需要安装啊,错误信息如下:
./configure --prefix=/usr/local/ttserver/ --with-tc=/usr/local/tc/
继续,make && make install
一切正常。
创建tokyotyrant数据文件存放目录
mkdir -p /ttserver/
启动tokyotyrant的主进程(ttserver)
单机模式启动:
/usr/local/ttserver/bin/ttserver -host 127.0.0.1 -port 11211 -thnum 8 -dmn -pid /ttserver/ttserver.pid -log /ttserver/ttserver.log -le -ulog /ttserver/ -ulim 128m -sid 1 -rts /ttserver/ttserver.rts /ttserver/database.tch
启动的时候可以会报告错误
ln -s /usr/local/tc/lib/libtokyocabinet.so.8 libtokyocabinet.so.8
把tc目录里的libtokyocabinet.so.8作软连接到ttserver里的lib即可,然后启动ttserver成功.
netstat -lnat 显示11211端口已打开,证明可以使用了。
测试代码:[code]<?PHP
$mem=new Memcache();
$mem->connect("127.0.0.1",11211);
$mem->add("key2","value2");
print_r( $mem->get("key2"));
echo "<hr>";
$mem->add("key3",array("value3"=>"this is value3"));
print_r($mem->get("key3"));
?>
[/code]运行php,输出:[code]value2a:1:{s:6:"value3";s:14:"this is value3";}[/code]证明成功!!!!
准备软件:
tokyocabinet,Tokyo Tyrant
关联软件,bzip2:
wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz
如果不安装的话,在你配置tc,tt的时候,就会报告一个bzip2.h 未定义(bzip2.h no required)的错误信息.
先安装bzip,简单看了下英文文档,里面说只要make install就可以安装了,无需configure,如果需要设定安装配置路径,可以在后面加上--prefix
如:make install prefix=/usr/local/...
OK,一切正常。
接着下载tc(tokyocabinet)
网上的一些文章提到http://tokyocabinet.sourceforge.net/下载,但是下载下来的文件缺少,所以我又花时间找到了一个可信的下载地址:
wget http://blog.s135.com/soft/linux/ ... abinet-1.3.1.tar.gz
wget http://sourceforge.net/projects/ ... .30.tar.gz/download
然后解压,
tar zvxf tokyocabinet-1.4.30.tar.gz
./configure --prefix=/usr/local/tc/
cd tokyocabinet-1.4.30
make && make inistall
一切顺利,继续:
现在安装ttserver了。
wget http://sourceforge.net/projects/ ... .33.tar.gz/download
cd tokyotyrant-1.1.33
./configure --prefix=/usr/local/ttserver/
最后出现了一个错误,看来还是有关联软件需要安装啊,错误信息如下:
configure: error: tcutil.h is required
一时间无从入手,最后还是看了下config的help,得出结论是,没有关联tc../configure --prefix=/usr/local/ttserver/ --with-tc=/usr/local/tc/
继续,make && make install
一切正常。
创建tokyotyrant数据文件存放目录
mkdir -p /ttserver/
启动tokyotyrant的主进程(ttserver)
单机模式启动:
/usr/local/ttserver/bin/ttserver -host 127.0.0.1 -port 11211 -thnum 8 -dmn -pid /ttserver/ttserver.pid -log /ttserver/ttserver.log -le -ulog /ttserver/ -ulim 128m -sid 1 -rts /ttserver/ttserver.rts /ttserver/database.tch
启动的时候可以会报告错误
/usr/local/ttserver/bin/ttserver: error while loading shared libraries: libtokyocabinet.so.8: cannot open shared object file: No such file or directory
解决办法:ln -s /usr/local/tc/lib/libtokyocabinet.so.8 libtokyocabinet.so.8
把tc目录里的libtokyocabinet.so.8作软连接到ttserver里的lib即可,然后启动ttserver成功.
netstat -lnat 显示11211端口已打开,证明可以使用了。
测试代码:[code]<?PHP
$mem=new Memcache();
$mem->connect("127.0.0.1",11211);
$mem->add("key2","value2");
print_r( $mem->get("key2"));
echo "<hr>";
$mem->add("key3",array("value3"=>"this is value3"));
print_r($mem->get("key3"));
?>
[/code]运行php,输出:[code]value2a:1:{s:6:"value3";s:14:"this is value3";}[/code]证明成功!!!!
作者: xieaotian 发布时间: 2009-08-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28