V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
leonchen83
V2EX  ›  分享创造

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

  •  1
     
  •   leonchen83 ·
    leonchen83 · 2018-07-20 14:12:11 +08:00 · 2234 次点击
    这是一个创建于 2078 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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
    
    6 条回复    2018-07-23 14:43:56 +08:00
    hnyoumfk
        1
    hnyoumfk  
       2018-07-21 18:20:10 +08:00
    尝试了使用 Release 版本和直接编译 git 上的源码,分别出现了下面问题:
    hnyoumfk
        2
    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
        3
    leonchen83  
    OP
       2018-07-23 14:19:26 +08:00
    我看一下
    leonchen83
        6
    leonchen83  
    OP
       2018-07-23 14:43:56 +08:00
    @hnyoumfk
    有任何问题都可以提 issue 或者私信我
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   951 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 21:04 · PVG 05:04 · LAX 14:04 · JFK 17:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.