Redis集群之主从复制错误:NOAUTH Authentication required解决方式
Reids集群之主从复制授权失败错误代码NOAUTH Authentication required,如下:
117764:S 13 Feb 2023 11:55:35.194 * Connecting to MASTER 192.168.1.2:7001
117764:S 13 Feb 2023 11:55:35.194 * MASTER <-> REPLICA sync started
117764:S 13 Feb 2023 11:55:35.195 * Non blocking connect for SYNC fired the event.
117764:S 13 Feb 2023 11:55:35.195 * Master replied to PING, replication can continue...
117764:S 13 Feb 2023 11:55:35.195 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required.
117764:S 13 Feb 2023 11:55:35.196 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required.
117764:S 13 Feb 2023 11:55:35.196 * Partial resynchronization not possible (no cached master)
117764:S 13 Feb 2023 11:55:35.196 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required.
117764:S 13 Feb 2023 11:55:35.196 * Retrying with SYNC...
117764:S 13 Feb 2023 11:55:35.197 # MASTER aborted replication with an error: NOAUTH Authentication required
架构配置:
主端口:7001
从端口:7002
解决方案
1.修改从库的配置redis.conf
因为配置设置了requirepass
2.从库连接主库也需要密码认证
增加一条配置
masterauth 你的主密码
重启服务
1.查找进程id,然后kill掉,不然会报错
ps -ef | grep redis
kill -9 pid 对应的进程号 (7002 对应的)
2.重启
redis-server ./7002/redis.conf
测试及检查是否正常
重启后再来查看日志
Connecting to MASTER 192.168.1.2:7001
78799:S 13 Feb 2023 11:55:53.259 * MASTER <-> REPLICA sync started
78799:S 13 Feb 2023 11:55:53.260 * Non blocking connect for SYNC fired the event.
78799:S 13 Feb 2023 11:55:53.260 * Master replied to PING, replication can continue...
78799:S 13 Feb 2023 11:55:53.261 * Trying a partial resynchronization (request 00abe83b722584efa6aea404d9f7d4d2bd163a58:1).
78799:S 13 Feb 2023 11:55:53.290 * Full resync from master: 354294f94435643ec4b9d27674ae5230f403c5ae:0
78799:S 13 Feb 2023 11:55:53.290 * Discarding previously cached master state.
78799:S 13 Feb 2023 11:56:00.722 * MASTER <-> REPLICA sync: receiving 349303117 bytes from master
78799:S 13 Feb 2023 11:56:02.637 * MASTER <-> REPLICA sync: Flushing old data
78799:S 13 Feb 2023 11:56:03.028 * MASTER <-> REPLICA sync: Loading DB in memory
78799:S 13 Feb 2023 11:56:05.908 * MASTER <-> REPLICA sync: Finished with success
78799:S 13 Feb 2023 11:56:05.911 * Background append only file rewriting started by pid 78840
ps:
看到主从复制一下success信息
MASTER <-> REPLICA sync: Finished with success
不再有错误提示为准,说明问题解决了
相关文章