Migrate your Redis® deployment to Northflank | Migrate Data to Northflank | Databases And Persistence | Northflank Application docs
v1

Databases And Persistence / Migrate Data to Northflank /

Migrate your Redis® deployment to Northflank

You can import your existing Redis®* data to Northflank either as a snapshot of the database or by using live replication to transfer existing and new keys to your Northflank Redis addon.

You should first create a Northflank Redis addon to import to.

note

There is currently an issue with RIOT which means URI handling is not working. Please specify the host, port, and password (and username if required) separately when running commands.

Import a snapshot using RIOT

You can import your current Redis instance's keys and values using RIOT . Download and install the tool on your local machine, or on the server with your existing Redis instance.

It is recommended that you make both the source Redis instance and the Northflank Redis addon publicly accessible over the internet. Alternatively, you can forward the Northflank addon to your local machine or existing Redis deployment and use the non-external command to connect securely.

The exact command you will need to run depends on your existing Redis provider and your Redis usage. You may need to configure reader options if you store a lot of keys, or big sets.

From managed service to Northflank

You can migrate from an existing service provider using the connection details for your existing Redis instance, and the connection details for your Northflank Redis addon, found on the connection details page.

## without TLS (forwarded Northflank addon)
riot -h <SOURCE_REDIS_HOST> -p <SOURCE_REDIS_PORT> -a <SOURCE_REDIS_PASSWORD> replicate -h <NORTHFLANK_REDIS_HOST> -p <NORTHFLANK_REDIS_PORT> -a <NORTHFLANK_REDIS_PASSWORD>

## with TLS enabled on Redis source and Northflank addon
riot -h <SOURCE_REDIS_HOST> -p <SOURCE_REDIS_PORT> -a <SOURCE_REDIS_PASSWORD> --tls --tls-verify=NONE replicate -h <NORTHFLANK_REDIS_HOST> -p <NORTHFLANK_REDIS_PORT> -a <NORTHFLANK_REDIS_PASSWORD> --tls --tls-verify=NONE

If you are not using the default user on your source Redis instance, you can also specify the user by including the --user flag.

From local machine to Northflank

You can migrate from your local machine, or via the terminal on your server, by specifying the hostname, port, and password for the local instance, and the connection details for your Northflank Redis addon as the target, found on the connection details page.

riot -h <LOCAL_REDIS_HOST> -p <LOCAL_REDIS_PORT> -a <LOCAL_REDIS_PASSWORD> -a  replicate -h <NORTHFLANK_REDIS_HOST> -p <NORTHFLANK_REDIS_PORT> -a <NORTHFLANK_REDIS_PASSWORD> --tls --tls-verify=NONE

If you are not using the default user on your local Redis instance, you can also specify the user by including the --user flag.

RIOT should import all keys and values from the source Redis instance to your Northflank addon, you can double-check that the import has run as you expected it to by accessing the addon and comparing keys and values.

Live replication using RIOT

You can configure live replication between your existing and Northflank Redis instances using RIOT's live replication mode .

This method will allow you to seamlessly migrate a Redis instance, as new keys created on the source will be transferred to your new Northflank Redis instance. This method uses pub/sub which means delivery is not guaranteed, and it may also fail if trying to copy big sets repeatedly. You should evaluate your Redis store for big sets before using these methods to migrate.

Before using live replication you will need to enable keyspace notifications in each Redis instance. You can do this by logging into each instance using redis-cli and entering the command CONFIG SET notify-keyspace-events KA.

You can use the same commands as to import a snapshot, adding the required mode flag at the end of the command:

Live only --mode liveonly

Live only mode will only replicate keys added or updated in your source Redis instance after the process has started, and not keys that currently exist in your source Redis.

Initial and live --mode live

Live mode will copy your current keys from your source Redis instance, as well as replicate any new keys and updates to keys from your source Redis while the process is running.

Verification and migration

You can double-check that replication is working as expected by accessing the addon manually, or running RIOT's compare command .

You can now configure your applications and infrastructure to use the Northflank Redis addon. Once your changes are live, you can terminate the RIOT replicate process and shut down your original source Redis instance.

© 2024 Northflank Ltd. All rights reserved.