Posted 16 days ago. Visible to the public.

Migrate data between Redis servers

There is a reasonable simple way to move data between Redis servers: Simply temporarily configure the new server as a replica of the old server.

To do this:

  • Make sure the new Redis server can access the old server. If they are on different networks, a simple SSH tunnel will do.
  • Connect to the new server using redis-cli.
  • Tail the log of the redis server (found in /var/logs/redis) in another terminal.
  • Make sure the server is currently master and not already a replica (check INFO replication)
  • Enable replication with REPLICAOF <host> <port> (on older Redis versions this is called SLAVEOF).
  • Redis will then drop all current data and fetch everything from the master.
  • Check the log. It will tell you if replication works and when it is done. It should usually only take a few seconds.
  • Disable replication with REPLICAOF no one.

This even works if the new server is itself master to other replicas.

By refactoring problematic code and creating automated tests, makandra can vastly improve the maintainability of your Rails application.

Owner of this card:

Avatar
Tobias Kraze
Last edit:
16 days ago
by Tobias Kraze
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Tobias Kraze to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more