在自己做实验准备迁移 有key-value的槽的时候,(执行指令是redis-trib.rb reshard)发现会出现报错:
报错内容为:Syntax error ,try CLIENT (LIST|KILL|GETNAME|SETNAME|PAUSE|REPLY)
但是迁移没有key-value的槽的时候就会执行成功。 这就说明问题出在了存不存在key-value上
我们找到reshard的执行过程:发现具体迁移步骤是通过 move_slot函数调用(redis-trib.rb文件中)。
打开move_slot函数,找到具体的迁移代码。
while true
keys = source.r.cluster("getkeysinslot",slot,o[:pipeline])
break if keys.length == 0
begin
source.r.client.call(["migrate",target.info[:host],target.info[:port],"",0,@timeout,"replace",:keys,*keys])
STDOUT.flush
rescue => e
if o[:fix] && e.to_s =~ /BUSYKEY/
xputs "*** Target key exists. Replacing it for FIX."
source.r.client.call(["migrate",target.info[:host],target.info[:port],"",0,@timeout,: