Score:0

Migrating Redis data from old cluster to another cluster

mx flag

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.

YOULYU ZHANG avatar
mx flag
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 avatar
mx flag
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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.