Redisexit code > 0

READONLY You can't write against a read only replica

$READONLY You can't write against a read only replica.

Analysis

You are trying to execute a write command (SET, DEL, etc.) on a Redis instance that is configured as a read-only replica (slave).

Common Triggers

  • Connecting to the wrong Redis instance (slave instead of master).
  • Failover happened, and the instance you are connected to was demoted.

Debug Checks

  • $Check role: INFO replication.

Resolution

1
Connect to the master instance.
2
If using Sentinel/Cluster, ensure your client respects the topology.

Metadata

Tool
Redis
Severity
High
Tags
#database#redis#replication