database network_error ai_generated partial

redis.exceptions.MasterDownError:错误:主节点已关闭或无法访问

redis.exceptions.MasterDownError: Error: Master is down or unreachable

ID: database/redis-master-link-down

其他格式: JSON · Markdown 中文 · English
85%修复率
86%置信度
1证据数
2024-03-15首次发现

版本兼容性

版本状态引入弃用备注
Redis 6.2.x active
Redis 7.0.x active
Redis 7.2.x active

根因分析

Redis 客户端无法连接到复制设置中的主节点,通常由于网络分区、主节点崩溃或 replicaof 指令配置错误。

English

The Redis client cannot connect to the master node in a replication setup, often due to network partition, master crash, or misconfigured replicaof directive.

generic

官方文档

https://redis.io/docs/latest/operate/oss_and_stack/management/replication/

解决方案

  1. 从副本检查主节点状态:redis-cli -h replica_host INFO replication | grep master_link_status;如果为 down,检查主节点:redis-cli -h master_host PING;如果需要,重启主节点:systemctl restart redis-server
  2. 在故障转移场景中将副本提升为主节点:redis-cli -h replica_host SLAVEOF NO ONE;然后重新配置其他副本指向新主节点。

无效尝试

常见但无效的做法:

  1. Restarting only the replica node 90% 失败

    If the master is down, restarting the replica does not fix the connection; the replica will still fail to sync.

  2. Increasing replica timeout in redis.conf without checking master health 70% 失败

    Increasing timeout only delays the error; it does not address the root cause of master unavailability.