Giter Site home page Giter Site logo

Comments (6)

leonchen83 avatar leonchen83 commented on May 19, 2024
        Replicator replicator = new RedisReplicator("redis://127.0.0.1:6379");
        DumpValueParser parser = new DefaultDumpValueParser(replicator);
        DumpKeyValuePair dkv = new DumpKeyValuePair();
        byte[] bytes = "\\r\\x1a\\x1a\\x00\\x00\\x00\\x12\\x00\\x00\\x00\\x02\\x00\\x00\\x06field1\\b\\x05Hello\\xff\\x06\\x00DC\\x19\\t\\xf9\\x8c\\xde`".getBytes();
        RedisCodec codec = new RedisCodec();
    
        dkv.setValue(codec.decode(bytes));
        KeyStringValueHash kv = (KeyStringValueHash)parser.parse(dkv);
        Map<byte[], byte[]> map = kv.getValue();
        for (Map.Entry<byte[], byte[]> entry : map.entrySet()) {
            System.out.println(new String(entry.getKey()));
            System.out.println(new String(entry.getValue()));
        }

from redis-replicator.

leonchen83 avatar leonchen83 commented on May 19, 2024

raw dump data need to decode by RedisCodec

from redis-replicator.

xiaozhiliaoo avatar xiaozhiliaoo commented on May 19, 2024

@leonchen83 非常感谢

from redis-replicator.

xiaozhiliaoo avatar xiaozhiliaoo commented on May 19, 2024

@leonchen83 我还有一个疑问,为什么我直接通过jedis api从redis dump下来数据,可以不用RedisCodec就可以解析了?

from redis-replicator.

leonchen83 avatar leonchen83 commented on May 19, 2024

因为二进制是不可打印的,会乱码。所以redis官方客户端输出dump的时候对不可打印字符做了16进制转义。jedis没做转义

from redis-replicator.

xiaozhiliaoo avatar xiaozhiliaoo commented on May 19, 2024

因为二进制是不可打印的,会乱码。所以redis官方客户端输出dump的时候对不可打印字符做了16进制转义。jedis没做转义

好的,非常感谢

from redis-replicator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.