Database Migration

Database Migration Service for Valkey

Elestio provides a structured approach for migrating Valkey databases from various environments, such as self-hosted servers, on-premises infrastructure, or other cloud platforms, to its managed services. This process ensures data integrity and minimizes downtime, facilitating a smooth transition to a high-performance, Redis-compatible environment.

Key Steps in Migrating to Elestio

Pre-Migration Preparation

Before initiating the migration process, it’s essential to undertake thorough preparation to ensure a smooth transition:

Initiating the Migration Process

With the preparatory steps completed, you can proceed to migrate your Valkey database to Elestio:

After entering the necessary details, click on “Run Check” to validate the connection. This step ensures that Elestio can securely and accurately connect to the source database. These details can also be found in your existing hosting or container environment settings.

image.png

Execute the Migration

If all checks pass without errors, initiate the migration by selecting “Start migration.” Monitor the progress via real-time logs displayed on the dashboard. This transparency helps you detect and resolve any issues immediately, ensuring uninterrupted and consistent data transfer.

Post-Migration Validation and Optimization

After completing the migration, it’s essential to perform a series of validation and optimization tasks to ensure the integrity and performance of your database in the new environment:

Benefits of Using Elestio for Valkey

Migrating your Valkey database to Elestio offers several advantages:

Cloning a Service to Another Provider or Region

Migrating or cloning services across cloud providers or geographic regions is a critical part of modern infrastructure management. Whether you’re optimizing for latency, preparing for disaster recovery, meeting regulatory requirements, or simply switching providers, a well-planned migration ensures continuity, performance, and data integrity. This guide outlines a structured methodology for service migration, applicable to most cloud-native environments.

Pre-Migration Preparation

Before initiating a migration, thorough planning and preparation are essential. This helps avoid unplanned downtime, data loss, or misconfiguration during the move:

Cloning Execution

The cloning process begins with restoring the backed-up data into the new Valkey environment. Connect to the target instance and stop the Valkey process temporarily to allow safe file replacement. Move the dump.rdb or appendonly.aof file into the correct storage location, typically /var/lib/valkey/, ensuring that file permissions match the expected user and group settings. Once the data is in place, restart the Valkey service and monitor logs to confirm a successful startup and key load.

After restoring data, verify the integrity and structure of the new instance. Use redis-cli or an equivalent client to query the dataset, confirm key counts, TTLs, and persistence settings. If your service uses custom modules, Lua scripts, or pub/sub channels, ensure they are functioning as expected. Review the configuration files (valkey.conf) to confirm replication, memory limits, eviction policies, and authentication are all consistent with the original service. For TLS-enabled instances, validate certificate paths, key permissions, and client connection behavior.

Test the service in isolation to validate correctness. This includes read/write operations, key expiration, background tasks, or pub/sub behavior. Simulate application queries and ensure that memory allocation, CPU usage, and persistence behavior match your expectations. Use observability tools to monitor performance and identify discrepancies. This is also the stage to update client configurations or environment variables if the connection endpoint or credentials have changed.

Once validation is complete, route live traffic to the new Valkey instance. This may involve updating DNS records to point to the new IP address, reconfiguring load balancers, or modifying firewall rules. If you’re using managed DNS with short TTLs, the switchover can be nearly instantaneous. For high-availability environments, consider running both instances in parallel temporarily and shifting client traffic gradually. Monitor logs, metrics, and connected clients throughout the transition to detect and resolve issues early.

Post-Migration Validation and Optimization

Once the new environment is live and receiving traffic, focus on optimizing and securing the setup:

Benefits of Cloning

Cloning a Valkey service enables safer testing, faster failover, and region-based redundancy. Teams can use cloned environments to stage changes, simulate workloads, or test application compatibility with newer Valkey versions without impacting production. Clones are also useful for development and QA workflows that require access to near-real datasets without write permission to production.

In disaster recovery planning, a cloned instance in a separate region can act as a ready-to-promote failover node. If the primary region becomes unavailable, DNS can be redirected to the backup instance with minimal delay. Additionally, analytics or reporting workloads can run against a cloned read-only copy to isolate them from critical workloads, ensuring consistent performance for real-time applications.

Additionally, rather than building a new environment from scratch, you can clone the database into another provider, validate it, and cut over with minimal disruption. This helps maintain operational continuity and reduces the effort needed for complex migrations.

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

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:

  1. Make your local container replicate to Elestio:

valkey-cli -h localhost -p 6379 SLAVEOF <elestio_host> <elestio_port>
  1. Authenticate as needed (Elestio may require AUTH).

  2. 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

This method complements Elestio’s automated features by offering a transparent, full-control migration workflow.