Skip to main content

Migrate Redis data to a Redis Managed Database using RedisShake

You can migrate Redis and Valkey data to Selectel with continuous synchronization and minimal downtime using RedisShake.

RedisShake connects to the source Redis as a replica. It first transfers a data snapshot (RDB) and an append-only file (AOF), and then continuously streams new changes to the target Redis until synchronization is stopped. Applications can be switched to the new Redis during data synchronization, minimizing service downtime.

This method is suitable for migration between sites and within the same environment, supporting various topologies, including Redis with Sentinel.

For data migration using RedisShake, Redis versions from 2.8 to 7.4 are supported. We recommend that the source and target Redis versions match.

Requirements

For small RedisShake installations, a configuration of 2 CPUs, 4 GB RAM, and 10 GB disk space is sufficient. Disk space depends on the size of the RDB and AOF files (parameters sync_rdb and sync_aof). For large amounts of data, we recommend estimating the required CPU performance based on benchmarks in the RedisShake documentation.

Additionally, you will need:

  • network access from the RedisShake environment to the source and target Redis;
  • RedisShake 4.x;
  • Docker and Docker Compose or a Kubernetes cluster if RedisShake is run in a container.

Migrate data

  1. Install RedisShake.

  2. Configure RedisShake.

  3. Start synchronization.

  4. Optional: check the migration status.

  5. Complete migration.

1. Install RedisShake

  1. Download the binary from the RedisShake repository on GitHub. You can also pull the Docker image:

    docker pull ghcr.io/tair-opensource/redisshake:latest
  2. If Redis is password-protected, pass it:

    redis-cli -h 127.0.0.1 -p 6379 -a '<password>'

    Specify <password> — Redis password.

  3. Make sure that the source Redis is accessible from the environment where RedisShake will run:

    redis-cli -h <host> -p <port> ping
    telnet <host> <port>

    Specify:

    • <host> — Redis address;
    • <port> — default Redis port.
  4. Check the cluster status and node list for Redis Cluster:

    redis-cli -h <host> -p <port> cluster info
    redis-cli -h <host> -p <port> cluster nodes

    Specify:

    • <host> — Redis address;
    • <port> — default Redis port.
  5. Check memory usage:

    redis-cli -h <host> -p <port> info memory

    Specify:

    • <host> — Redis address;
    • <port> — default Redis port.
  6. Repeat steps 3–5 to check the target Redis.

2. Configure RedisShake

  1. Open the CLI.

  2. Open the shake.toml file in a text editor.

  3. Set synchronization parameters. If the source or target Redis is Redis Cluster, specify cluster = true for it. For a complete reference of shake.toml parameters, see the RedisShake repository on GitHub.

[sync_reader]
cluster = false
address = "<source_address>:6379"
username = ""
password = ""
tls = false
sync_rdb = true
sync_aof = true
# prefer_replica = false
# try_diskless = false

[redis_writer]
cluster = false
address = "<target_address>:6379"
username = ""
password = ""
tls = false
off_reply = false

Specify:

  • <source_address> — source Redis address;
  • <target_address> — target Redis address.

3. Start synchronization

Before starting, check that the configuration file shake.toml is populated and located in the correct path.

  1. Open the CLI.

  2. Prepare docker-compose.yaml:

    services:
    redis-shake:
    image: ghcr.io/tair-opensource/redisshake:latest
    container_name: redis-shake
    volumes:
    - ./shake.toml:/app/shake_sync_env.toml:ro
    - ./data:/app/data
    environment:
    SYNC: "true"
  3. Run Docker Compose:

    docker compose up -d

4. Optional: Check migration status

During synchronization, RedisShake continuously writes status and current operations to the log. You can use the log to track how many changes are still remaining.

  1. Open the CLI.

  2. Enable real-time display of RedisShake logs:

    tail -f data/shake.log
  3. Verify the number of keys in the source and target Redis:

    redis-cli -h <source_host> -p <source_port> dbsize
    redis-cli -h <target_host> -p <target_port> dbsize

    Specify:

    • <source_host> — source Redis address;
    • <source_port> — source Redis port;
    • <target_host> — target Redis address;
    • <target_port> — target Redis port.

5. Complete migration

  1. Switch applications to the new Redis while synchronization is still running. This ensures that changes made prior to the switch are not lost.

  2. When all data has been transferred, stop RedisShake using the same method you used to start it.

    1. Open the CLI.

    2. Stop and remove containers:

      docker compose down