// 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
Categoria
Cluster and replication
Mensagem de erro
NOREPLICAS Not enough good replicas to write.

O que significa

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.

Causas comuns

  • 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?

Como corrigir

  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.

Reproduza com segurança

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.

Perguntas

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.

Erros relacionados

More cluster and replication errors

O código e o texto da mensagem são de Redis documentation and source code. Veja toda a Redis error list ou pesquise todos os erros do banco de dados.

// menos erros, correções mais rápidas

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.

Texto e dados desta página: CC BY 4.0, com crédito ao SQLly (sqlly.app). Código e trechos SQL: MIT. Detalhes da licença O texto citado das mensagens de erro pertence ao fornecedor do banco de dados.