tokyo tyrant安装<2>

阅读更多
原创  ttserver备份和还原 收藏

由于人为的错误操作或机器的不可靠性等原因导致数据的丢失,这是经常发生在我们身边的事,所以需要定期的备份,ttserver为我们提供了很好的备份功能。

启动服务
ttserver -port 19780 -thnum 8 -dmn -pid /tmp/test.pid -log /tmp/test.log -le -ulog /tmp/ -rts /tmp/test.rts /tmp/test.tch

插入数据
tcrmgr put -port 19780 localhost key value

查询数据
tcrmgr get -port 19780 localhost key
得到的结果是:value

备份数据
tcrmgr copy -port 19780 localhost /tmp/backup.tch

kill掉ttserver

删除数据
rm /tmp/test.tch

恢复数据
cp /tmp/backup.tch /tmp/test.tch

重启ttserver
ttserver -port 19780 -thnum 8 -dmn -pid /tmp/test.pid -log /tmp/test.log -le -ulog /tmp/ -rts /tmp/test.rts /tmp/test.tch

再次查询数据
tcrmgr get -port 19780 localhost key
得到的结果仍是:value,说明成功的还原了数据

附tcrmgr命令参数
tcrmgr inform [-port num] [-st] host
  tcrmgr put [-port num] [-sx] [-sep chr] [-dk|-dc|-dai|-dad] [-ds num] host key value
  tcrmgr out [-port num] [-sx] [-sep chr] host key
  tcrmgr get [-port num] [-sx] [-sep chr] [-px] [-pz] host key
  tcrmgr mget [-port num] [-sx] [-sep chr] [-px] host [key...]
  tcrmgr list [-port num] [-sep chr] [-m num] [-pv] [-px] [-fm str] host
  tcrmgr ext [-port num] [-xlr|-xlg] [-sx] [-sep chr] [-px] host func [key [value]]
  tcrmgr sync [-port num] host
  tcrmgr optimize [-port num] host [params]
  tcrmgr vanish [-port num] host
  tcrmgr copy [-port num] host dpath
  tcrmgr misc [-port num] [-mnu] [-sx] [-sep chr] [-px] host func [arg...]
  tcrmgr importtsv [-port num] [-nr] [-sc] [-sep chr] host [file]
  tcrmgr restore [-port num] [-ts num] [-rcc] host upath
  tcrmgr setmst [-port num] [-mport num] [-ts num] [-rcc] host [mhost]
  tcrmgr repl [-port num] [-ts num] [-sid num] [-ph] host
  tcrmgr http [-ah name value] [-ih] url
  tcrmgr version

你可能感兴趣的:(EXT)