You can't write against a read only replica

155 views
Skip to first unread message

Ankit Gupta

unread,
Dec 14, 2021, 8:37:45 AM12/14/21
to Redis DB
Hi Experts,

We are using redis version 5.x, and using sentinel based architecture.

Below is the setup

                              N1(M)
                              /         \
                            /             \
                         N2(S)         N3(S)

N1 got crashed  , and due to failover N3 was promoted as a new master. After sometime when N1 was recovered & joined the setup/cluster as slave it requested for a full re-synchronization from N3(present master) due to which BGSave was invoked. 

During this process any request on master , was giving below error:

org.springframework.data.redis.connection.RedisPipelineException: Pipeline contained one or more invalid commands; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: READONLY You can't write against a read only replica.; nested exception is redis.clients.jedis.exceptions.JedisDataException: READONLY You can't write against a read only replica.

We have few queries around this
1. Are we getting this error because master was busy in serving any other request?
2. Is there a configuration we can do so that if another slave is already connected then new node should do sync from existing slave?
3. Is this the expected behaviour?

Thanks in advance.

-Ankit



Reply all
Reply to author
Forward
0 new messages