redis集群:MASTER aborted replication with an error: NOAUTH Authentication required.
阅读原文时间:2023年08月09日阅读:1

发现个问题:redis集群所在服务器,磁盘空间很快就被占满,使用 “du -sh *”查看每个文件夹的大小,发现redis集群三个从节点的日志文件占用空间很大。

下面记录问题排查及解决办法:


1. redis集群从节点日志文件

2. 查看redis集群从节点日志文件信息

32947:S 12 Dec 2022 11:12:17.970 * Retrying with SYNC…
32947:S 12 Dec 2022 11:12:17.970 # MASTER aborted replication with an error: NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.970 * Reconnecting to MASTER 192.168.0.120:6691 after failure
32947:S 12 Dec 2022 11:12:17.970 * MASTER <-> REPLICA sync started
32947:S 12 Dec 2022 11:12:17.970 * Non blocking connect for SYNC fired the event.
32947:S 12 Dec 2022 11:12:17.970 * Master replied to PING, replication can continue…
32947:S 12 Dec 2022 11:12:17.970 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.970 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.970 * Partial resynchronization not possible (no cached master)
32947:S 12 Dec 2022 11:12:17.971 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.971 * Retrying with SYNC…
32947:S 12 Dec 2022 11:12:17.971 # MASTER aborted replication with an error: NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.971 * Reconnecting to MASTER 192.168.0.120:6691 after failure
32947:S 12 Dec 2022 11:12:17.971 * MASTER <-> REPLICA sync started
32947:S 12 Dec 2022 11:12:17.971 * Non blocking connect for SYNC fired the event.
32947:S 12 Dec 2022 11:12:17.971 * Master replied to PING, replication can continue…
32947:S 12 Dec 2022 11:12:17.971 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.971 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.971 * Partial resynchronization not possible (no cached master)
32947:S 12 Dec 2022 11:12:17.971 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.971 * Retrying with SYNC…
32947:S 12 Dec 2022 11:12:17.971 # MASTER aborted replication with an error: NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.971 * Reconnecting to MASTER 192.168.0.120:6691 after failure
32947:S 12 Dec 2022 11:12:17.971 * MASTER <-> REPLICA sync started
32947:S 12 Dec 2022 11:12:17.971 * Non blocking connect for SYNC fired the event.
32947:S 12 Dec 2022 11:12:17.971 * Master replied to PING, replication can continue…
32947:S 12 Dec 2022 11:12:17.971 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.971 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required.
32947:S 12 Dec 2022 11:12:17.971 * Partial resynchronization not possible (no cached master)
32947:S 12 Dec 2022 11:12:17.971 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required.

3. 问题原因

  原因是master节点设置了密码,而在从节点的配置中,没有配置masterauth参数导致的。

  当进行主从配置的时候,如果master节点开启了安全机制并设置了密码的话,就需要在从节点配置文件中配置masterauth参数,该参数就是master节点的密码(即master节点中requirepass参数的值),否则的话,master节点会拒绝同步请求。redis一直抛异常,文件不断增大,直至磁盘空间占满。

4. 解决办法

  三个从节点的masterauth参数均配置密码后,重启redis集群,问题解决。