What are the steps for setting up a Redis master-slave configuration?
Setting up Redis master-slave replication involves the following steps:
- Modify the configuration file on the Redis master instance by setting the slaveof option to the IP address and port number of the slave instance. For example: slaveof
- Restart the main instance of Redis to apply the configuration changes.
- Modify the configuration file on the Redis slave instance by setting the “slaveof” option to the IP address and port number of the master instance. For example: slaveof
. - Restart the Redis slave instance to apply the configuration.
- You can use the command INFO replication to check if the master-slave relationship has been successfully established.
Note: When setting up master-slave replication, the data from the master instance will be copied to the slave instance, making the slave instance a full copy of the master instance.