leonchen83/redis-rdb-cli

`rmt -r` does not work in versions prior to Redis 3.0

tao12345666333 opened this issue ยท 4 comments

The RESTORE command add in Redis 2.6, REPLACE option add in Redis 3.0.

If we use rmt -r in versions prior to Redis 3.0, it doesn't work fine.

https://github.com/leonchen83/redis-rdb-cli/blob/master/src/main/java/com/moilioncircle/redis/rdb/cli/ext/rmt/SingleRdbVisitor.java#L95-L99

if (!replace) {  
    endpoint.get().batch(flush, RESTORE, dkv.getKey(), expire, dkv.getValue());  
} else {  
    endpoint.get().batch(flush, RESTORE, dkv.getKey(), expire, dkv.getValue(), REPLACE);  
}  

Should we replace the implementation of Replace with Lua?

LGTM
I will fix this issue this weekend. Thx to report

Hi @tao12345666333
The work around about this issue is add additional parameter in rmt like following

rmt -s redis://120.0.0.1:6379 -m redis://127.0.0.1:6380 -r --legacy means using lua script to migrate data to target redis < 3.0

Migrate data to cluster no need to add this parameter. because cluster's redis version >= 3.0

Thanks, I will test next week. ๐Ÿ‘

Fixed