分享一个新的 rdb 内存分析以及格式转换工具,速度极快

2018-07-20 14:12:11 +08:00
 leonchen83

Redis-cli-tool

https://github.com/leonchen83/redis-cli-tool

Redis mass insertion


rct -f dump -s /path/to/dump.rdb -o /path/to/dump.aof -r
cat /path/to/dump.aof | /redis/src/redis-cli -p 6379 --pipe

Convert rdb to dump format

rct -f dump -s /path/to/dump.rdb -o /path/to/dump.aof

Convert rdb to json format

rct -f json -s /path/to/dump.rdb -o /path/to/dump.json

Find top 50 largest keys

rct -f mem -s /path/to/dump.rdb -o /path/to/dump.mem -l 50

Diff rdb

rct -f diff -s /path/to/dump1.rdb -o /path/to/dump1.diff
rct -f diff -s /path/to/dump2.rdb -o /path/to/dump2.diff
diff /path/to/dump1.diff /path/to/dump2.diff

Convert rdb to RESP

rct -f resp -s /path/to/dump.rdb -o /path/to/appendonly.aof

Migrate rdb to remote redis

rmt -s /path/to/dump.rdb -m redis://192.168.1.105:6379 -r

Backup remote redis's rdb

rdt -b redis://192.168.1.105:6379 -o /path/to/dump.rdb

Filter rdb

rdt -b /path/to/dump.rdb -o /path/to/filtered-dump.rdb -d 0 -t string

Split rdb via cluster's nodes.conf

rdt -s ./dump.rdb -c ./nodes.conf -o /path/to/folder -d 0

Merge multi rdb to one

rdt -m ./dump1.rdb ./dump2.rdb -o ./dump.rdb -t hash
2269 次点击
所在节点    分享创造
6 条回复
hnyoumfk
2018-07-21 18:20:10 +08:00
尝试了使用 Release 版本和直接编译 git 上的源码,分别出现了下面问题:
hnyoumfk
2018-07-21 18:22:51 +08:00
@hnyoumfk 接上条没打完。。。
使用如下命令:
./rct -f mem -s ~/Desktop/redis-recommend-20180531-0001.rdb -o ~/Desktop/dump_ddd.mem -l 500

1.使用 Release 版本出现下列错误:
Unsupported field: YearOfEra

2.使用源码编译版本出现下列错误:
Exception in thread "main" java.lang.NullPointerException
at com.moilioncircle.redis.cli.tool.util.ProgressBar.show(ProgressBar.java:84)

谢谢 0.0
leonchen83
2018-07-23 14:19:26 +08:00
我看一下
leonchen83
2018-07-23 14:38:26 +08:00
leonchen83
2018-07-23 14:42:13 +08:00
leonchen83
2018-07-23 14:43:56 +08:00
@hnyoumfk
有任何问题都可以提 issue 或者私信我

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/472652

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX