You might have a pre-existing Redis service running and would want to migrate data from it to Aiven for Redis.

The source Redis service must be either publicly accessible or there must a VPC peering between the private networks. See our help article for setting up project VPC and peering connection if needed. E.g. AWS ElastiCache for Redis instances cannot have public IP addresses and thus require project VPC and peering connection.

Note that at the moment migrating from Google Cloud Memorystore for Redis isn't supported.

Migrating to new Aiven for Redis service

In this example we create a new Aiven for Redis service and migrate data from AWS ElastiCache Redis. Project VPC and peering connection are already created. Throughout the example the Aiven project name is test and service name for the target Aiven for Redis is redis .

Let's start by checking the available configuration options for migration from Aiven client:

$ avn service types -v
...
Service type 'redis' options:
...
  Remove migration
     => --remove-option migration
  Hostname or IP address of the server where to migrate data from
     => -c migration.host=<string>
  Password for authentication with the server where to migrate data from
     => -c migration.password=<string>
  Port number of the server where to migrate data from
     => -c migration.port=<integer>
  The server where to migrate data from is secured with SSL
     => -c migration.ssl=<boolean>  (default=True)
  User name for authentication with the server where to migrate data from
     => -c migration.username=<string>

So we need the hostname, port and password of the source Redis. The source Redis is also secured with SSL which is the default for migration.

We also need project VPC id and cloud name:

$ avn vpc list --project test
PROJECT_VPC_ID                        CLOUD_NAME     ...
====================================  =============
40ddf681-0e89-4bce-bd89-25e246047731  aws-eu-west-1

Let's next create a new Aiven for Redis service:

$ avn service create --project test -t redis -p hobbyist --cloud aws-eu-west-1 --project-vpc-id 40ddf681-0e89-4bce-bd89-25e246047731 -c migration.host="master.jappja-redis.kdrxxz.euw1.cache.amazonaws.com" -c migration.port=6379 -c migration.password=<password> redis

If the source Redis server is publicly accessible then project-vpc-id and cloud parameters are not needed.

Migration status

You can view the status of the migration with:

$ avn service migration-status --project test redis
STATUS  METHOD  ERROR
======  ======  =====
done    scan    null

Status can be one of done, failed or running. In case of failure error has the error message, e.g. with invalid password:

$ avn service migration-status --project test redis
STATUS  METHOD  ERROR          
======  ======  ================
failed  scan    invalid password

Method is either replication  or scan . Migration is first tried using replication and if that fails it falls back to using scan. E.g. AWS ElastiCache for Redis has SYNC/PSYNC commands disabled and thus we cannot use replication.

Migrating to an existing Aiven for Redis service

It's also possible to migrate data to existing Aiven for Redis service by updating the service configuration:

$ avn service update --project test -c migration.host="master.jappja-redis.kdrxxz.euw1.cache.amazonaws.com" -c migration.port=6379 -c migration.password=<password> redis

Removing migration from configuration

$ avn service update --project test --remove-option migration redis

Migration is one-time operation: once the status is done the migration cannot be restarted. If migration needs to be run again then it must be first removed from the configuration and then configured again.

Got here by accident? Learn how Aiven simplifies managing Redis in the Cloud:

Did this answer your question?