How to Backup Your Redis Instance

 • Angelo Saraceno

Redis is a popular choice for an in-memory data structure store that also persists to disk. For many projects it is used as a database, cache, and a message broker.
At Railway, you can provision and add Redis to your project in as easy as one-click. However, there comes a time when you need to perform a backup of your Redis instance. Recently, within our
Discord, we've had a couple of users ask us how they'd go about performing a backup of their Railway Project's Redis instance. This blog post will guide you on how to do just that.


Before we get started, you will need Redis installed locally. We are also assuming you are running this on a Unix based system (MacOS, Linux).

Getting Started

On one terminal instance, first run the following command. This will first start Redis locally on your machine.


Then, on a different terminal instance, run the CLI to connect to the instance.


Time to Auth

The reason why we set up a local Redis instance is because we are going to designate the local Redis instance to replicate the Railway plugin in your project.

In the Terminal that is running redis-cli enter the following command to enter the password of the Redis plugin.

config set masterauth <password>

You can get the password from your Railway project's variables and then clicking the Redis tab..

After you configure the password, you will need to start the replication process on your local instance by entering the following command in the terminal where redis-cli is running.

SLAVEOF <host> <port>

You can get the connection url under the plugin interface for your project.

Replication Underway

After you perform that command, your local instance should begin replication. To see information about the replication status, you can enter the following in the terminal where redis-cli is running.

INFO replication

The output should look like the following


Retrieving Your Backup

After INFO replication shows that there is no sync in progress when you see that the sync property is 0 like: master_sync_in_progress: 0. You are now ready to save locally what is on your local Redis instance.
You can do this by entering the following command in the


The output of this command will tell you where in the system Redis saved the instance's data as a dump.rdb file. Now, you have your backup!


Before you stand down your instance, run the following in your redis-cli before you shut down redis-server. This is done so your Redis server won't attempt to sync with the Railway plugin any further.


And with that, you should have all the information you need to backup your Redis instance on Railway! We at Railway are working to allow you to retrieve backups from the dashboard to make it easier to manage.

If you have any suggestions for more tutorials you'd like to see guides for, let us know on Discord.