Search code examples
redisredis-cluster

Redis - copy keys from server/s to new cluster


I wanted to migrate data from several standalone Redis servers to a single cluster in the cloud.

Redis version of source servers: 2.6

I've looked into different approaches:

REPLICAOF

This is not an option since the new target cluster does not allow the use of the REPLICAOF command.

Using a tool that supports client-side replication

Tools like RIOT or Redis-Shake cannot be used since the commands 'SCAN', and 'PSYNC' have only been available since 2.8

MIGRATE command

I'm thinking of using MIGRATE command along with KEYS.

Ideally, I don't want to delete the source key.

However, the MIGRATE [COPY] option is only available since 3.0.0

And the MIGRATE [KEYS] option is only available since 3.0.6


Solution

  • What worked for me:

    • Dump RDB files for all the source servers
    • Write those RDB files to the target cluster using redis-migrate-tool.