Redis集群 主从复制 错误 NOAUTH Authentication required
Reids 集群 主从复制授权失败
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
我们修改从库的配置 redis.conf
因为配置设置了 requirepass
从库连接主库也需要密码认证
增加一条配置masterauth 你的主密码
重启服务
ps -ef | grep redis
kill -9 pid 对应的进程号(7002 对应的)
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
看到主从复制 success 不再有错误提示