ttulmgr
The command `ttulmgr' is the utility to export and import the update log. It is useful to filter the update log with such text utilities as `grep' and `sed'. This command is used in the following format. `upath' specifies the update log directory.
ttulmgr export [-ts num] [-sid num] upath- Export the update log as TSV text data to the standard output.
ttulmgr import upath- Import TSV text data from the standard input to the update log.
Options feature the following.
This command returns 0 on success, another on failure.
注意:
1. 指定 sid 的作用不是说只查看sid产生的日志,而是说不要查看sid产生的日志,源码(ttulmgr.c,procexport函数)中是这么写的:

2. 通过上图的189行可以知道,输出只能是16进制的个数,不能是ascii码的
3. 输入格式说明:
1306566730093092 3101:3101 put C8 10 00 00 00 43 00 00 00 4E 54
其中:
1306566730093092 是微妙级时间戳
3101:3101 分别是 sid:mid 即: serverid ,masterid; 如果masterid没有,则为0
put: 是指令的文本描述
c8...: 这些就是指令参数的16进制表示了
tokyo tyrant采用的是从机向主机拉式的主从同步策略,并且有一个限制,一个从库只能从一个主库同步数据。另外tokyo tyrant在写操作的时候都会加锁。这样对同一个key的写操作就会被顺序执行,不会出现并发操作的情况。且主辅库均可进行读写操作。
下面是几种同步策略:
1. 
2. 
3. 
1. 因为是用的迭代的方式,所以内存使用很少
2. 迭代的过程如下,效率是非常地的:
sendto(3, "\310Q", 2, 0, NULL, 0) = 2 (continue)
recvfrom(3, "\0\0\0\0CTGT-MTI5NjI0OTk5MA==-130492"..., 65536, 0, NULL, NULL) = 72 (接收key)
sendto(3, "\3100\0\0\0CTGT-MTI5NjI0OTk5MA==-13049"..., 73, 0, NULL, 0) = 73 (get key)
recvfrom(3, "\0\0\0\0L{\"uid\":\"1296249990\",\"et\":13"..., 65536, 0, NULL, NULL) = 81 (接收value)
测试脚本:
- <?php
- $tt = new TokyoTyrant();
- $connected = $tt->connect($host, $port);
- $it = $tt->getIterator();
- foreach ($it as $key=>$val) {
- }
参考资料:
http://www.couchbase.com/merger
http://www.couchbase.com/products-and-services/membase-server
http://www.cnbeta.com/articles/134461.htm




2011/05/28 15:38 | 
