Copying Redis Database from one server to another

20 / Feb / 2013 by raj 0 comments

In my recent project, I needed to copy the redis database from one server to another. Although redis provides SAVE and BGSAVE commands, I found another cool way of doing it.

Log in to the new server and execute the following command in terminal:

redis-cli slaveof IP-ADDRESS-OF-OLD-SERVER 6379

The above command starts replicating the data stored in redis database of old server to redis database of new server. Here, 6379 is the default port which redis uses. Once the replication is done, we issue the following command :

redis-cli slaveof no one

Now we have the entire redis database copied to the new server.

Raj Gupta


Leave a Reply

Your email address will not be published. Required fields are marked *