In Chapter 1, Getting Started with Redis, we learned how to set up a Redis Server. A Redis Server runs in master mode by default. In this recipe, we will demonstrate how to set up a Redis slave server to replicate from the master server.
Setting up Redis replication
Getting ready…
You need to finish the installation of Redis Server as we described in the Downloading and installing Redis recipe in Chapter 1, Getting Started with Redis.
Prepare a configuration file for the Redis slave server. You can make a copy of redis.conf and rename it redis-slave.conf, then make the following changes:
port 6380 pidfile /var/run/redis_6380.pid dir ./slave slaveof 127.0.0.1 6379
Don't forget to create /redis/slave directory...