Manual Migration Using valkey-cli and Dump Files
Manual migrations using Valkey’s native tools are ideal for users who prefer full control over data export and import, particularly during provider transitions, environment duplication, or when importing an existing self‑managed Valkey dataset into Elestio’s managed environment. This guide walks through the process of performing a manual migration to and from Elestio Valkey services using command‑line tools, ensuring that your data remains portable, auditable, and consistent.
Valkey is fully compatible with Redis tooling, including valkey-cli, valkey-server, and snapshot formats (dump.rdb, appendonly.aof). For clarity, this guide uses valkey-cli and valkey-server where applicable. If you’re using a Redis‑compatible CLI, the commands remain the same.
When to Use Manual Migration
Manual migration using valkey-cli is well‑suited for scenarios where full control over the data export and import process is required. This method is particularly useful when migrating from an existing Valkey or Redis‑compatible setup whether self‑hosted, on‑premises, or on another cloud provider into Elestio’s managed Valkey service. It allows for one‑time imports without requiring continuous connectivity between source and target systems.
This approach also supports version upgrades (via snapshot restore into newer versions), selective key imports, and offline backup archiving ideal when Elestio’s built‑in tools aren’t applicable.
Performing the Migration
Prepare the Environments
-
Source: Ensure your Valkey server (valkey-server) is running with RDB or AOF persistence and remote TCP connections permitted.
-
Target (Elestio): Provision a Valkey service. From the Dashboard → Database Admin tab, collect hostname, port, and password. Make sure your IP is allowed via Cluster Overview → Security → Limit access per IP.
Create a Backup Dump
To generate a snapshot file:
valkey-cli -h <source_host> -p <source_port> SAVE
Alternatively, to write dump.rdb directly:
valkey-cli --rdb dump.rdb
These commands create a portable, version-aware RDB snapshot (). If the source uses AOF, disable AOF temporarily to force a clean RDB dump.
Transfer the Dump File to the Target
Use secure transfer methods to move the snapshot file:
scp dump.rdb user@your_workstation:/path/to/local/
Elestio doesn’t require uploading the file to its servers; restore happens over the network or locally via Docker.
Create the Target Container or Instance
To inspect or stage the dataset locally before final import, run:
docker run -v /path/to/backup:/data --name valkey-restore -p 6379:6379 valkey/valkey
This container auto-loads the RDB on start for verification or live sync to Elestio.
Restore the Data into Elestio
Connect to Elestio using:
valkey-cli -h <elestio_host> -p <elestio_port> -a <elestio_password>
You can import via --pipe or use live replication:
-
Make your local container replicate to Elestio:
valkey-cli -h localhost -p 6379 SLAVEOF <elestio_host> <elestio_port>
-
Authenticate as needed (Elestio may require AUTH).
-
When sync completes, stop replication:
valkey-cli -h localhost -p 6379 SLAVEOF NO ONE
This is ideal for large datasets or when direct file upload isn’t available.
Validate the Migration
After syncing, connect to the Elestio instance:
valkey-cli -h <elestio_host> -p <elestio_port> -a <elestio_password>
Run these checks:
DBSIZE
KEYS *
GET some_key
TYPE some_key
Validate TTLs and data structures. Ensure your application can read/write without errors. Enable automated backups post-migration to secure the restored dataset.
Benefits of Manual Migration
-
Compatibility and Portability: Snapshot files from any Valkey/Redis source can be imported.
-
Version-Safe Upgrades: RDB restores across Valkey versions seamlessly.
-
Offline Archiving: Store snapshots for disaster recovery or historical analysis.
-
Platform Independence: Uses Valkey-native tools no vendor lock-in.
This method complements Elestio’s automated features by offering a transparent, full-control migration workflow.
No comments to display
No comments to display