當redis cluster集羣設置密碼的時候,使用migirate需要加上密碼,否則會報如下異常:
(error) ERR Target instance replied with error: NOAUTH Authentication required.
redis在3.0之前是不支持migrate帶有password的,在3.0之後可以在migrate中加入auth參數來做權限校驗
127.0.0.1:6380> migrate 192.168.0.33 6380 "" 0 2000 auth mypassword keys user:{info}:age user:{info}:id
OK
注意不要把auth password放到最後面,否則migrate會將會auth mypassword都當做key,結果報出如下錯誤,該錯誤是說migrate要遷移的多個key不在同一個slot中
(error) CROSSSLOT Keys in request don't hash to the same slot