0

I've got 2 redis cluster, and I wish to move a lot of data from old cluster to new cluster.

I've write a script using redis-cli and MIGRATE command. It success at about first 20 keys, then it start failing and getting this error.

10.233.141.88:11300: MOVED 13905 10.233.141.9:11300

10.233.141.10:11300: MOVED 13905 10.233.141.9:11300

10.233.141.89:11300: MOVED 13905 10.233.141.9:11300

10.233.141.9:11300: ERR Target instance replied with error: MOVED 13905 10.241.164.59:7000

10.233.141.90:11300: MOVED 13905 10.233.141.9:11300

10.233.141.91:11300: MOVED 13905 10.233.141.9:11300

Also when I query the new redis, all migrated key is in node1. node2 and node3 are empty.

The migrate command I use is in following format, and I can't find an option which can move old data to new cluster and balance it.

redis-cli -a ${OLD_REDIS_PASSWORD} --cluster call ${OLD_REDIS_NODE1_IP}:${OLD_REDIS_NODE1_PORT} MIGRATE ${NEW_REDIS_NODE1_IP} ${NEW_REDIS_NODE1_PORT} ${KEY} 0 100 COPY AUTH ${NEW_REDIS_PASSWORD}

Is there a way to move data to a cluster using MIGRATE command.

  • I think the cause is redis-cli treat the target instance as standalone deployment, instead of cluster. But I don't know how to deal with it. – YOULYU ZHANG Jan 25 '23 at 09:20
  • I've find a walkaround. I `sed` the response of that command to get the `MOVED` IP, and run `MIGRATE` command with the `MOVED` IP again, which allow me to get `OK` response from `MIGRATE` command. I also randomly picking one of three node from target cluster as destination of `MIGRATE` command, maybe this way can reduce load during migration. Better solusion is very welcomed. – YOULYU ZHANG Jan 25 '23 at 11:06

0 Answers0