Migrate From Redis Cluster

Consolidate a stable Redis Cluster dataset into standalone Lavik, with one replication stream per source primary.

Choose The Target Topology

Use a fresh standalone Lavik target with enough disk and memory for the source dataset. Attaching a source can replace destination data. Do not use a Meta-managed / --cluster-enabled target: beta.1 rejects Redis replication in that mode. Take a source backup and rehearse the complete move before the production cutover.

This workflow consolidates source shards into one standalone Lavik instance; it does not preserve Redis Cluster node IDs or turn the destination into a Meta-managed Lavik cluster. Configure a standalone client for the new endpoint at cutover. If you need a Meta-managed destination instead, plan a separate application-level transfer into a freshly created Lavik topology.

Beta.1 imports RDB versions 1–11 and logical databases 0–15. A newer Redis release or an unsupported encoding can prevent full synchronization. Self-describing Module 2 and Function-library records may be skipped with a warning; older or unknown formats can be rejected. Inventory these separately and recreate only features supported by Lavik. Unsupported incremental commands stop replication. Check your command set, scripts, TTLs, ACL requirements and client settings. Use a length-delimited full-sync stream: configure repl-diskless-sync no on each Redis source through your normal configuration process. Coordinate that source-side change with its owner and account for RDB disk space and fork overhead.

Freeze The Slot Layout

Inventory every slot-owning primary from CLUSTER NODES and require complete, non-overlapping coverage of slots 0–16383. Resolve failures and migrating/importing slots before starting. Suspend resharding and automatic scale operations for the migration window. A stable primary failover retaining exactly the same slots can be discovered; a changed slot layout is not merged automatically and can stop all source sessions. Restore a stable layout and reattach all required primaries before continuing.

Attach Every Primary

The command examples assume private, trusted endpoints with no authentication for a rehearsal. Set LAVIK_HOST, LAVIK_PORT, REDIS_HOST and REDIS_PORT to the actual endpoints. Lavik must be able to reach Redis directly; localhost refers to Lavik’s own host or container. Configure upstream credentials and TLS before attaching authenticated sources; never put passwords in copied terminal commands or expose an unauthenticated instance publicly.

The example below shows three source primaries. Define REDIS_HOST_2 / REDIS_PORT_2 and REDIS_HOST_3 / REDIS_PORT_3 as well, and repeat ADDREPLICAOF for additional primaries. All primaries must advertise reachable addresses and the same frozen slot layout. The target remains LOADING until all advertised slot-owning primaries are registered and synchronized. Do not attach replicas or overlapping sources.

attach-cluster.sh

Linux · bash
# Begin with one slot-owning Redis primary; never use a replica endpoint.
redis-cli -h "$LAVIK_HOST" -p "$LAVIK_PORT" REPLICAOF "$REDIS_HOST" "$REDIS_PORT"
# Repeat ADDREPLICAOF for EVERY remaining slot-owning primary.
redis-cli -h "$LAVIK_HOST" -p "$LAVIK_PORT" ADDREPLICAOF "$REDIS_HOST_2" "$REDIS_PORT_2"
redis-cli -h "$LAVIK_HOST" -p "$LAVIK_PORT" ADDREPLICAOF "$REDIS_HOST_3" "$REDIS_PORT_3"
redis-cli -h "$LAVIK_HOST" -p "$LAVIK_PORT" INFO replication

Inspect the per-source entries in INFO replication and verify keys from every source primary. The overall link state or one successful GET is insufficient. If Lavik restarts, replay the complete source attachment sequence; runtime additions and Redis replication cursors are not persisted.

Catch Up And Cut Over

An OK response acknowledges the role change; it does not mean the copy is complete. Keep the target attached until initial sync finishes and normal reads work. Pause every source writer, including scheduled jobs. Capture each source’s replication offset after the write pause, identify the Lavik replica connection, and confirm its ACK reaches that captured watermark. Replication PINGs and expiration traffic can continue advancing offsets. Compare representative values, data types, key counts and TTLs. Cluster sources require this check independently for every primary. Do not detach during LOADING: an incomplete load can be discarded. If a stream fails or any data type is missing, keep the source authoritative and fix the problem before cutover.

detach.sh

Linux · bash
# Only after source writers are paused and all source streams are caught up.
# Never detach a target that is still LOADING or incompletely synchronized.
redis-cli -h "$LAVIK_HOST" -p "$LAVIK_PORT" REPLICAOF NO ONE
redis-cli -h "$LAVIK_HOST" -p "$LAVIK_PORT" ROLE
# Runtime attachment turns Tomb Raider off. Re-enable its cleanup schedule.
redis-cli -h "$LAVIK_HOST" -p "$LAVIK_PORT" TOMBRAIDER INTERVAL 1000

After ROLE reports master, point applications at the Lavik endpoint and resume writes there. Run a small application read/write check before restoring full traffic. Keep Redis fenced against writes. Rollback is a routing change only before Lavik accepts new writes; afterwards reconcile or replay those writes before returning to Redis. REPLICAOF is not a bidirectional migration or a zero-data-loss guarantee.