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

<p class="callout info">Valkey is fully compatible with Redis tooling, including <span class="s2">valkey-cli</span>, <span class="s2">valkey-server</span>, and snapshot formats (<span class="s2">dump.rdb</span>, <span class="s2">appendonly.aof</span>). For clarity, this guide uses <span class="s2">valkey-cli</span> and <span class="s2">valkey-server</span> where applicable. If you’re using a Redis‑compatible CLI, the commands remain the same.</p>

## **When to Use Manual Migration**

Manual migration using <span class="s2">valkey-cli</span> 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**

- <span class="s1">**Source**</span>: Ensure your Valkey server (<span class="s2">valkey-server</span>) is running with RDB or AOF persistence and remote TCP connections permitted.
- <span class="s1">**Target (Elestio)**</span>: 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:

```bash
valkey-cli -h <source_host> -p <source_port> SAVE
```

Alternatively, to write <span class="s1">dump.rdb</span> directly:

```bash
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:

```bash
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:

```bash
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:

```bash
valkey-cli -h <elestio_host> -p <elestio_port> -a <elestio_password>
```

You can import via <span class="s1">--pipe</span> or use live replication:

1. Make your local container replicate to Elestio:

```bash
valkey-cli -h localhost -p 6379 SLAVEOF <elestio_host> <elestio_port>
```

1. Authenticate as needed (Elestio may require <span class="s1">AUTH</span>).
2. When sync completes, stop replication:

```bash
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:

```bash
valkey-cli -h <elestio_host> -p <elestio_port> -a <elestio_password>
```

Run these checks:

```bash
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**

- <span class="s1">**Compatibility and Portability:**</span> Snapshot files from any Valkey/Redis source can be imported.
- <span class="s1">**Version-Safe Upgrades:**</span> RDB restores across Valkey versions seamlessly.
- <span class="s1">**Offline Archiving:**</span> Store snapshots for disaster recovery or historical analysis.
- <span class="s1">**Platform Independence:**</span> Uses Valkey-native tools no vendor lock-in.

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