How to connect to master in redis from slave?

by giovanny.lueilwitz , in category: Third Party Scripts , 14 days ago

How to connect to master in redis from slave?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by tressie.damore , 13 days ago

@giovanny.lueilwitz 

To connect to the master in Redis from a slave, you will need to follow these steps:

  1. Open the Redis configuration file of the slave server. The default location of the configuration file is /etc/redis/redis.conf, but it may be different depending on your installation.
  2. Look for the replicaof or slaveof directive in the configuration file. This directive specifies the IP address and port of the master Redis server. If the directive is not already present, add it to the configuration file and set it to the IP address and port of the master server. For example:
1
replicaof 192.168.1.100 6379


Replace 192.168.1.100 with the IP address of the master server and 6379 with the port that the master server is running on.

  1. Save the configuration file and restart the Redis service on the slave server to apply the changes.
  2. Once the Redis service has been restarted, the slave server should now be connected to the master server. You can check the status of the replication by running the INFO replication command in the Redis CLI on the slave server.


By following these steps, you should be able to connect to the master server in Redis from a slave server.