• rdb解析rdb文件


    环境:
    Os:Centos 7
    Python:3.6.5

    1.安装rdbtools

    [root@localhost ~]# pip3 install rdbtools
    Collecting rdbtools
      Downloading https://files.pythonhosted.org/packages/dd/e5/eebb748863d74b7f9d433e359b874d97e830e9d1b3e3d876b91b5cba6b9d/rdbtools-0.1.15.tar.gz
    Collecting redis (from rdbtools)
      Downloading https://files.pythonhosted.org/packages/91/f1/cbae04b7bdf1ae5f952dcf6babfe413647663e73fef8061a5d3c08b0b6f4/redis-4.0.0-py3-none-any.whl (118kB)
        100% |████████████████████████████████| 122kB 486kB/s 
    Collecting deprecated (from redis->rdbtools)
      Downloading https://files.pythonhosted.org/packages/51/6a/c3a0408646408f7283b7bc550c30a32cc791181ec4618592eec13e066ce3/Deprecated-1.2.13-py2.py3-none-any.whl
    Collecting wrapt<2,>=1.10 (from deprecated->redis->rdbtools)
      Downloading https://files.pythonhosted.org/packages/e2/0f/89c9c2d8ba06709a3d471507a78be443e2c2d9f1321d3e1154c76f44150c/wrapt-1.13.3-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (78kB)
        100% |████████████████████████████████| 81kB 1.6MB/s 
    Installing collected packages: wrapt, deprecated, redis, rdbtools
      Running setup.py install for rdbtools ... done
    Successfully installed deprecated-1.2.13 rdbtools-0.1.15 redis-4.0.0 wrapt-1.13.3
    You are using pip version 9.0.3, however version 21.3.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.

    2.安装python-lzf
    pip3 install python-lzf


    3.使用
    [root@localhost ~]# rdb -help

    转换成json格式
    rdb -c json /tmp/7001-dump.rdb>/tmp/7001dump.txt

    4.rdb文件比较差异
    [root@localhost ~]# rdb --command diff /tmp/dump.rdb | sort > /tmp/dump1.txt
    [root@localhost ~]# rdb --command diff /tmp/7001-dump.rdb| sort > /tmp/dump2.txt

    运行差异程序
    安装kdiff3
    [root@localhost tmp]#yum install kdiff3 ##python2环境下执行
    [root@localhost tmp]# kdiff3 dump1.txt dump2.txt

  • 相关阅读:
    使用 Jackson – 将字符串转换为 JsonNode 对象
    Java 8 及其后续版本的新遍历 forEach
    IntelliJ IDEA 快速插入 for 循环
    在 Discourse 中如何使用输入对话框
    如何修改 Discourse 的域名
    Confluence 数据中心版本接近生命周期了
    IntelliJ IDEA 中如何将 POM 中的版本号快速提出为属性
    RedHat 8 如何检查端口是否联通
    二、RabbitMq安装
    一、RabbitMQ 的概念
  • 原文地址:https://www.cnblogs.com/hxlasky/p/15560865.html
Copyright © 2020-2023  润新知