Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: rmt sync from cluster to single redis #33

Open
sgohl opened this issue Jul 8, 2022 · 1 comment
Open

Feature Request: rmt sync from cluster to single redis #33

sgohl opened this issue Jul 8, 2022 · 1 comment
Assignees
Milestone

Comments

@sgohl
Copy link

sgohl commented Jul 8, 2022

Hi,

I am looking for the best way to export a full redis-cluster to a single redis instance.

I know: rmt is able to sync a (given) cluster node to a single redis.
I also know that rmt is able to fetch the list of CLUSTER NODES and get only the masters with their IPs and Ports, because it's presumably what -m does, otherwise it would not work without the cluster.conf

AFAIK, there is no good/short/clean way to get the cluster masters into a bash list.

look how ugly it would be, to sync all keys from all cluster masters into a single redis:

HOSTS=$(redis-cli -a ${REDIS_DEST_PASS} -h ${REDIS_DEST} -p ${REDIS_DEST_PORT} -c cluster nodes | grep master | awk '{ print $2 }' | cut -f1 -d'@')

for HOST in $HOSTS
do
  rmt -s redis://default:${REDIS_DEST_PASS}@${HOST} -m redis://${REDIS_STAGE} -r -d 0
done

This works, but I'm curious if you could

  1. provide a command to output the list of cluster masters in a cleaner approach,
    and possibly,
  2. implement this loop (i mean, the complete sync/migration) with rmt , like this:
rmt -s redis://default:password@AnyClusterMember:Port -m redis://Target-Single-Redis:Port -r

I think, rmt should safely be able to always check if the source is a cluster or not and proceed to work as "expected"
where in case source is a single, proceed as usual.
in case its a cluster, fetch the masters, and loop over them repeating the usual bgsave and dump to target. This should seemlessly work, even if the target is also a cluster

@leonchen83
Copy link
Owner

Hi
This is a good idea.
But we need to consider more about how we handle master switch to replica. and how other CLI command add cluster support.

  1. provide a command to output the list of cluster masters in a cleaner approach,
    and possibly,

yes. we can add above command to get cluster masters and do more than that : provide a series commands to manage all cluster nodes.

implement this loop (i mean, the complete sync/migration) with rmt , like this:
rmt -s redis://default:password@AnyClusterMember:Port -m redis://Target-Single-Redis:Port -r

if we provide that command can get cluster masters. users can wirte their own shell to loop masters.

@leonchen83 leonchen83 added this to the v1.0.0 milestone Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants