使用redis-migrate-tool的时候,有可能抛出以下错误
[2019-10-18 04:05:49.267] rmt_redis.c:6446 ERROR: Can't handle RDB format version 839003080
[2019-10-18 04:05:49.267] rmt_redis.c:6715 ERROR: Rdb file for node[127.0.0.1:7002@17002] parsed failed
redis-migrate-tool迁移工具最高支持到rdb7版本,而你使用的redis生成rdb版本已经超过了7,例如,你是用的redis5.0
修改 rmt_redis.c 文件,将7改为10或更高的数
/* ========================== Redis RDB ============================ */
/* The current RDB version. When the format changes in a way that is no longer
* backward compatible this number gets incremented. */
#define REDIS_RDB_VERSION 7 ###修改这行,将7改为10
你需要保证你的redis中没有用到redis的高级特性。高级特性可以参考如下地址:
https://github.com/sripathikrishnan/redis-rdb-tools/blob/master/docs/RDB_Version_History.textile
This document tracks the changes made to the dump file format over time.
Redis dump file is 100% backwards compatible. An older dump file format will always work with a newer version of Redis.
The following additions have been made :
The following additions have been made :
The following additions have been made :
In previous versions, ziplists used a variable length encoding scheme for integers.
Integers were stored in 16, 32 or 64 bits. In this version, this variable length
encoding system has been extended.
The following additions have been made :
Issue ID : https://github.com/antirez/redis/issues/469
To migrate to version 5 :
list-max-ziplist-entries
to 0SAVE
commandREDIS0005
This version introduced an 8 byte checksum (CRC-32) at the end of the file. If checksum is disabled in redis.conf,
the last 8 bytes will be zeroes.
Issue ID : https://github.com/antirez/redis/issues/366
To migrate to version 4 -
0xFF
)REDIS0004
This version introduced a new encoding for hashmaps - “Hashmaps encoded as Zip Lists”. This version also deprecates
the Zipmap encoding that was used in previous versions.
“Hashmaps encoded as ziplists” has encoding type = 13. The value is parsed like a ziplist, and adjacent entries
in the list are considered key=value pairs in the hashmap.
Issue ID : https://github.com/antirez/redis/pull/285
To migrate to version 3 -
hash-max-ziplist-entries
to 0SAVE
commandREDIS0003
This version introduced key expiry with millisecond precision.
Earlier versions stored key expiry in the format 0xFD <4 byte timestamp>
. In version 3, key expiry is stored as
0xFC <8 byte timestamp>
. Here, 0xFD and 0xFC are the opcodes to indicate key expiry in seconds and milliseconds respectively.
Issue ID : https://github.com/antirez/redis/issues/169
To migrate to version 2 -
REDIS0002
0xFC <8 byte timestamp>
to 0xFD <4 byte timestamp>
.REDIS0002
This version introduced special encoding for small hashmaps, lists and sets.
Specifically, it introduced the following encoding types -
REDIS_RDB_TYPE_HASH_ZIPMAP = 9
REDIS_RDB_TYPE_LIST_ZIPLIST = 10
REDIS_RDB_TYPE_SET_INTSET = 11
REDIS_RDB_TYPE_ZSET_ZIPLIST = 12
Commit : https://github.com/antirez/redis/commit/6b52ad87c05ca2162a2d21f1f5b5329bf52a7678
To migrate to version 1 -
hash-max-zipmap-entries, list-max-ziplist-entries, set-max-intset-entries, zset-max-ziplist-entries
REDIS0001