RDB-Parser enables users to parse a RDB file(Redis Snapshot file) into XML-formatted file.
use lua to parse rdb file to user's format data, like aof file, json etc.
$ cd rdbtools/src
$ make
$ ./rdbtools -f ../tests/dump2.8.rdb -s ../scripts/example.lua
USAGE: ./rdbtools [-f file] -V -h
-V --version
-h --help show usage
-f --file specify which rdb file would be parsed.
-s --file specify which lua script, default is ../scripts/example.lua
If you want to handle key-value in rdb file, you can use -s your_script.lua
, and lua function handle
will be callbacked.
Example can be found in scripts/example.lua
, and it just print the key-value.
cat scripts/json_exapmle.lua
local cjson = require "cjson"
function handle(item)
print(cjson.encode(item))
end
Blog
: codetopia
any bugs? send mail, and I will appreciate your help.