轻量级持久存储系统 Tokyo 初窥篇

这套Tokyo系列有三个产品,Cabinet是数据库,Tyrant提供管理Cabinet的接口,Dystopia提供全文索引。我把Cabinet理解为存储引擎,Tyrant类似mysql的管理器,Dystopia则是插件。

Tokyo Cabinet是日本人开发的一款数据库,它的功能比较简单,只能键值保存,没有检索功能,以hash table、b+tree、fixed-length array保存。

Tokyo Cabinet有如下特点:
[list][*]键值保存数据库
[*]数据文件小
[*]高性能,插入1百万记录只需0.4秒(250万 rps),查询1百万记录只需0.3秒(300万 rps)
[*]高并发,支持多线程,读写支持锁记录
[*]使用简单,通过memcached客户端直接使用(需Tyrant)
[*]支持64位架构,容量大
[*]支持事务
[/list]

Tokyo Tyrant提供管理Cabinet的接口,支持memcached协议,所以,可以通过memcached客户端连接Cabinet。

Tokyo Tyrant有如下特点:
[list][*]提供使用Cabinet的接口
[*]支持通过memcached和http协议连接
[*]高并发,查询100万记录17.2秒(5.8万 rps)
[*]支持热备份,复制功能,主持主主(可读写)和主从(分写和读)方式
[/list]

用Cabinet加上Tyrant实现轻量级持久化存储系统,用来分担数据库的压力,实际上和新浪的memcachdb差不多。我的想法是用memcached做缓存,Tyrant持久储存频繁修改或者不需要检索功能的数据。

ok...先安装再说

[b]1.安装Cabinet[/b]
要求[list][*]linux 不低于2.4
[*]gcc 不低于3.1
[*]zlib 不低于1.2.3
[*]bzip2 不低于1.0.5
[/list]
下载:http://tokyocabinet.sourceforge.net/tokyocabinet-1.4.5.tar.gz
[quote]tar zxvf tokyocabinet-1.4.5.tar.gz
cd tokyocabinet-1.4.5
./configure
make
make install[/quote]
[quote]Options of Configure
The following options can be specified with `./configure'.

--enable-debug : build for debugging. Enable debugging symbols, do not perform optimization, and perform static linking.
--enable-devel : build for development. Enable debugging symbols, perform optimization, and perform dynamic linking.
--enable-profile : build for profiling. Enable profiling symbols, perform optimization, and perform dynamic linking.
--enable-static : build by static linking.
--enable-fastest : build for fastest run.
--enable-off64 : build with 64-bit file offset on 32-bit system.
--enable-swab : build for swapping byte-orders.
--enable-uyield : build for detecting race conditions.
--disable-zlib : build without ZLIB compression.
--disable-bzip : build without BZIP2 compression.
--disable-pthread : build without POSIX thread support.
--disable-shared : avoid to build shared libraries.
[/quote]

[b]2.安装Tyrant[/b]
下载:http://tokyocabinet.sourceforge.net/tyrantpkg/tokyotyrant-1.1.14.tar.gz
[quote]tar zxvf tokyotyrant-1.1.14.tar.gz
cd tokyotyrant-1.1.14
./configure
make
make install
mkdir -p /ttserver/
ttserver -host 192.168.1.254 -port 11311 -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
[/quote]

失望啊失望啊,用php memcached客户端连接Tyrant有bug([url]http://willko.iteye.com/blog/332982[/url]),Tyrant只提供了Perl和Ruby的客户端

参考资料:
http://tokyocabinet.sourceforge.net/
http://blog.s135.com/post/362.htm
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值