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- Kategorie
- Cluster and replication
Was es bedeutet
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.
Häufige Ursachen
- 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?
Wie du es behebst
-
Compare the healthy-replica count with the configured minimum:
INFO replication CONFIG GET min-replicas-to-write CONFIG GET min-replicas-max-lag
-
Restore connectivity or capacity to the replicas; writes resume automatically once the guard is satisfied.
-
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.
Sicher reproduzieren
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.
Fragen
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.
Zugehörige Fehler
More cluster and replication errors
MASTERDOWNStale data is not allowed to be servedMOVEDThe key lives on another cluster nodeASKThe key is migrating to another nodeCROSSSLOTMulti-key command spans two slotsCLUSTERDOWNThe cluster cannot serve this slotTRYAGAINSlot is rehashing, retry the command
Der Code und der Meldungstext stammen aus der Redis documentation and source code. Durchstöbere die vollständige Redis error list oder Jeden Datenbankfehler durchsuchen.
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.
Text und Daten auf dieser Seite: CC BY 4.0, Quelle: SQLly (sqlly.app). Code und SQL-Snippets: MIT. Lizenzdetails Zitierte Fehlermeldungstexte gehören dem jeweiligen Datenbankhersteller.