// Redis error reference

NOREPLICAS: Too few healthy replicas to write

With min-replicas-to-write set, the primary refuses writes when fewer than that many replicas are connected and within the lag bound.

Error prefix
NOREPLICAS
Категория
Cluster and replication
Сообщение об ошибке
NOREPLICAS Not enough good replicas to write.

Что это значит

NOREPLICAS is a write-availability guard. When min-replicas-to-write and min-replicas-max-lag are set, the primary tracks how many replicas are connected and acknowledging within the lag window, and it refuses writes while that count is short. The point is bounded data loss: a primary that cannot replicate should not be accepting writes nobody will see if it dies.

It reads like a replica-side error, but it is the primary refusing. Typical triggers are network partitions that silence replicas, replicas down for maintenance, and lag bounds set tighter than the workload allows, so the guard trips even though the replicas are technically connected.

Распространённые причины

  • Replicas are disconnected, crashed or cut off by the network, and the connected count fell below the minimum.
  • Replicas are connected but too slow: their acknowledgements exceed min-replicas-max-lag seconds.
  • The bounds were configured for an older topology and no longer match the fleet.

Find the cause

INFO replication
# The connected replicas with their lag
CONFIG GET min-replicas-*
redis-cli -h replica-1 INFO replication | grep master_link_status
# Are the replicas healthy from their own point of view?

Как исправить

  1. Compare the healthy-replica count with the configured minimum:

    INFO replication
    CONFIG GET min-replicas-to-write
    CONFIG GET min-replicas-max-lag
  2. Restore connectivity or capacity to the replicas; writes resume automatically once the guard is satisfied.

  3. Relax the guard only consciously, such as for a maintenance window. CONFIG SET takes effect at once but is lost on restart. To persist it, set min-replicas-to-write in the config file the server was started with, then run CONFIG REWRITE (it fails with "The server is running without a config file" when the server was started from the command line):

    CONFIG SET min-replicas-to-write 0
    CONFIG REWRITE

Other ways to handle it

The two settings work as a pair: a wide lag bound tolerates slow replicas, a low minimum tolerates fewer of them. Redis Sentinel fails over when it marks the master down (+sdown/+odown), and a primary that still answers PING while refusing writes does not meet that test, so Sentinel does not clear a NOREPLICAS guard. Restoring replica health is the fix.

Безопасное воспроизведение

redis-server --port 7311 --min-replicas-to-write 1 --min-replicas-max-lag 10 --save '' &
redis-cli -p 7311 SET foo bar
# (error) NOREPLICAS Not enough good replicas to write.

Вопросы

Why is my healthy primary refusing writes?

It is the durability guard: not enough replicas are acknowledging in time. The primary itself is fine; its replication is not.

Does this apply to Redis Cluster?

Yes, per primary. A cluster primary with the guard configured also refuses writes when its replica count dips below the minimum.

Связанные ошибки

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. Подробнее о лицензии Цитируемый текст сообщений об ошибках принадлежит производителю СУБД.