Redis Stand-alone Builds a Master-slave Copy Error [How to Solve]

Premise: connect Huawei ECS purchased by individuals on the xshell platform, install redis, and build a master-slave replication architecture on a single machine

Problem: after the setup is completed, start the slave node. The slave node Ping the master node succeeds, but the master status is displayed as down, and the background log prompts that the connection times out. As shown below:

Solution:

1. Check the configuration of the slave node: is replicaof correct.

It should be configured as the IP of Linux and the redis port of the master node

2. Check whether the master node is configured with a password. If so, the slave node also needs to be configured with a password

3. Check whether the Ping configuration of the primary node configures a single non own IP. If so, comment it out or change it to 0.0.0.0

4. Check whether the firewall is on. There are two types of firewalls

1. Iptables firewall

View firewall service iptables status     If this firewall is not installed, the query will fail.

Stop firewall   service iptables stop

Turn on the firewall   service iptables start

service iptables restart   service iptables restart

Permanently turn off the firewall   chkconfig iptables off

Restart firewall after permanent shutdown   chkconfig iptables on

2.Firewall firewall

View firewall service status   systemctl status firewalld

Turn off firewall   service firewalld stop

View firewall rules   firewall-cmd --list-all

Permanently open 80 ports   firewall-cmd --permanent --add-port=80/tcp

service iptables restart  firewall-cmd --reload (restart after modifying firewall configuration)

4. After I tried the above, I still reported the same error. Finally, I found that the IP configuration of my slave node replicaof was wrong. I mistakenly thought that the IP connected to xshell was the Linux IP I should configure. Who knows, I actually need to use my local IP 127.0.0.1

Read More: