今天配置redis主从复制时出现master_link_status:down提示。

首先打开slave的redis.conf配置文件,确定slaveof 和masterauth 两个选项配置是否正确。

然后再把后台进程的选项关闭:daemonize no(应该大多数同学为了方便把它设为yes了)

slave再启动时出现如下提示:

 

[10144] 14 May 01:04:22 * Connecting to MASTER...
[10144] 14 May 01:04:22 * MASTER <-> SLAVE sync started
[10144] 14 May 01:04:22 * Non blocking connect for SYNC fired the event.
[10144] 14 May 01:04:22 # Unable to AUTH to MASTER: Writing to master: No route to host

说slave连接不上master,那就可能是防火墙的原因了。于是用下面命令分别把master和slave防火墙关掉之后重启,搞定!

service iptables stop