![]() |
VOOZH | about |
By Mark Drake
Manager, Developer Education
When looking to migrate data from one Redis instance to another, there are a number of methods one could employ, such as replication or snapshotting. However, migrations can get more complicated when you’re moving data to a Redis instance managed by a cloud provider, as managed databases often limit how much control you have over the database’s configuration.
This tutorial outlines one method you can use to migrate data to a Redis instance managed by DigitalOcean. The method involves creating a Bash script that uses Redis’s internal migrate command to securely pass data through a TLS tunnel configured with stunnel. This guide will also go over a few other commonly-used migration strategies and why they’re problematic when migrating to a DigitalOcean Managed Database.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Former Technical Writer at DigitalOcean. Focused on SysAdmin topics including Debian 11, Ubuntu 22.04, Ubuntu 20.04, Databases, SQL and PostgreSQL.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I struggled with the migration script at first because all of my keys weren’t included in scan 0
I found I could add count onto the end that is greater than my number of keys to get it to iterate through everything.
redis-cli -n source_database -a source_password scan 0 count 2500
Also redis 4.0.7 is the minimum version to support authentication with the MIGRATE command.
Thanks for the article!
It worked well for me in a staging test with ~30,000 keys, but unfortunately there seems to be an upper-limit to the amount of keys this can migrate.
I tried it on a server with ~130,000 keys and the script never output anything, only hung and then back to prompt. In the meantime, the redis-server in the background hung / crashed / rebooted but with no data loss.
Does this actually work anymore? I saw in another thread that we can’t use redis-cli because it does not support TLS. And it says to use redli which does connect correctly.
But this entire document is about redis-cli, which can’t connect to your managed redis database.
What if I’m migrating a Redis Docker container? Will it work to install stunnel on the Docker host?
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.