Redis集群中发现Redis主从数据没同步,报错“Error condition on socket for SYNC: Connection refused”解决方案

  • 问题:Redis集群,从服务启动后,发现Redis主从数据没同步,日志文件报错“Error condition on socket for SYNC: Connection refused”

    查看对应redis服务的配置文件,找到日志文件路径(“logfile”参数值)
    比如从服务对应的日志文件是“/var/rdb/logfile6380.txt”和“/var/rdb/logfile6381.txt”等

    tail -f /var/rdb/logfile6380.txt
    

    发现内容如下,一直报错

    ...
    Error condition on socket for SYNC: Connection refused
    ...
    Error condition on socket for SYNC: Connection refused
    ...
    Error condition on socket for SYNC: Connection refused
    ...
    
  • ★★解决方法★★:
    从服务器的配置文件redis6380.conf、redis6381.conf中的“replicaof”参数值要写“127.0.0.1 6379”,不要写“localhost 6379”

    replicaof 127.0.0.1 6379
    

你可能感兴趣的:(Linux,redis,linux,分布式)