// Redis error reference

MASTERDOWN: Stale data is not allowed to be served

The replica lost its link to the primary and, because it is set to refuse stale data, it answers reads with MASTERDOWN instead.

Error prefix
MASTERDOWN
카테고리
Cluster and replication
오류 메시지
MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.

의미

MASTERDOWN comes from a replica whose link to its primary is down while replica-serve-stale-data is no. Normally a disconnected replica keeps answering reads from the data it already has; with that setting it refuses instead, so clients cannot silently read data that may be minutes old.

The setting exists for caches that must never serve stale content, and it is strict on purpose: while the link is down, read commands fail with this error, including reads of keys that have not changed in days. Writes on the same replica fail with READONLY instead. The fix belongs to the replication link, not to the client.

일반적인 원인

  • The primary is down, restarting, or unreachable from the replica because of a network or firewall change.
  • replica-serve-stale-data no is set, which turns an ordinary disconnection into failed reads.
  • A failover left this node replicating from an address that no longer exists.

Find the cause

redis-cli -p 7303 INFO replication
# master_link_status:down and master_link_down_since_seconds:N
# On the primary side, is the replica connecting at all?
redis-cli -h master-host INFO replication | grep -E 'connected|slave|replica'

해결 방법

  1. Check the link state and when it was last healthy:

    redis-cli -p 7303 INFO replication | grep -E 'master_link_status|master_last_io|master_host'
    # master_link_status:down
  2. Restore the link. Most cases are a restarted primary or a network change:

    redis-cli -p 7303 REPLICAOF <master-host> 6379
  3. If serving stale data temporarily is acceptable for this cache, allow it until the link returns:

    redis-cli -p 7303 CONFIG SET replica-serve-stale-data yes

Other ways to handle it

Sentinel watches the link and promotes another replica when the primary dies, so reads move to a live node instead of failing. If you rely on replica-serve-stale-data no, put a health check in front that stops routing traffic to a replica with master_link_status:down.

안전하게 재현하세요

redis-server --port 7303 --replicaof 127.0.0.1 6399 --replica-serve-stale-data no --save '' &
redis-cli -p 7303 GET foo
# (error) MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.

질문

MASTERDOWN or READONLY: how do they differ?

Both come from replicas. READONLY is a write on a healthy replica. MASTERDOWN is any read on a replica configured to refuse stale data while its link is down. A write to that replica gets READONLY first.

Which commands still work during MASTERDOWN?

INFO, REPLICAOF and other management commands work; data commands are refused. That is what lets you fix the link in the first place.

관련 오류

More cluster and replication errors

코드와 메시지 텍스트의 출처는 다음과 같습니다 Redis documentation and source code. 전체 목록은 Redis error list 또는 모든 데이터베이스 오류 검색.

// 오류는 줄이고, 수정은 빠르게

Work on Redis in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Redis and the other databases you use.

이 페이지의 텍스트와 데이터: CC BY 4.0, 출처: SQLly (sqlly.app). 코드와 SQL 스니펫: MIT. 라이선스 세부 정보 인용된 오류 메시지 텍스트의 권리는 해당 데이터베이스 공급업체에 있습니다.