Comments (6)
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.
raw dump data need to decode
by RedisCodec
from redis-replicator.
@leonchen83 非常感谢
from redis-replicator.
@leonchen83 我还有一个疑问,为什么我直接通过jedis api从redis dump下来数据,可以不用RedisCodec就可以解析了?
from redis-replicator.
因为二进制是不可打印的,会乱码。所以redis官方客户端输出dump的时候对不可打印字符做了16进制转义。jedis没做转义
from redis-replicator.
因为二进制是不可打印的,会乱码。所以redis官方客户端输出dump的时候对不可打印字符做了16进制转义。jedis没做转义
好的,非常感谢
from redis-replicator.
Related Issues (20)
- 从一个clusterA的slaveA同步到另一个clusterB的masterB,如果slaveA或者masterB挂了的话,怎么实现故障转移和断点续传 HOT 5
- redis集群同步 HOT 1
- 扫描RDB文件时如何获取Redis内存信息 HOT 4
- 3.4.4版本的maven下载不下来 HOT 2
- ZPopMinCommand.java类中key属性缺失 HOT 1
- 目前支持的redis的版本 HOT 5
- replStreamDB的作用是什么 HOT 1
- 如何实现从某个点续传呢?我尝试这样实现抛出异常了 HOT 4
- 有计划支持Tendis吗? HOT 1
- 请问有提供golang版本吗? HOT 1
- Exception in parse redis command "set a 1010 px 1000" HOT 5
- how to use redis aof log parser HOT 4
- 请问读取aof文件支持offset吗? HOT 2
- 您好,我把这个工具改成了一个redis流量监控的工具,但是我用JDK9编译,JDK11运行时,这个工具占用内存特别高,而且不稳定,请问这个和jdk的版本有什么关系吗? HOT 1
- 关于从inputStream()读取命令的代码 HOT 2
- 对比 HOT 1
- 做两个集群间的持续同步复制(用于多活)是否可行,是否有考虑主备切换,offset点位错乱的问题 HOT 1
- 流控不准确 HOT 2
- 监听psync报错 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis-replicator.