关于Redis配置主从复制踩到的坑!!!

设置单机集群的时候,两台从机都显示连接到主机,但是主机显示连接到的从机数量为0:

主机信息:
在这里插入图片描述
从机80:

从机81:
在这里插入图片描述
查看从机log日志文件发现错误信息:

MASTER aborted replication with an error: NOAUTH Authentication required.

主库master要求密码验证!
因为之前配置redis的密码,在配置文件中将requirepass注释掉即可!
重启Redis,成功!!!
在这里插入图片描述
所以:

  • 对于Redis集群,如果设置了requirepass,则一定要设置masterauth,否则从节点无法正常工作!!!

其实仔细阅读redis.conf文件会发现:
redis说明了

# If the master is password protected (using the "requirepass" configuration
# directive below) it is possible to tell the replica to authenticate before
# starting the replication synchronization process, otherwise the master will
# refuse the replica request.
#
# masterauth <master-password>

翻译:

如果主服务器是密码保护的(使用“requirepass”配置)

可以告诉副本在之前进行身份验证

启动复制同步进程,否则主进程将执行此操作

拒绝复制请求。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值