I'm trying to figure out what the expected behavior is in a Redis Sentinel setup (NOT Redis Cluster) if you accidentally issue a write command (such as SET
or BLPOP
) to a Redis slave. My instinct was that you would immediately receive back an error (though I don't know what the error code would be). We saw something strange today in our production environment that makes it seem like the actual behavior is that it blocks forever instead of immediately returning an error (in this case, BLPOP
was the specific command we issued). I'm trying to figure out which rabbit hole to go down: The rabbit hole of our Redis configuration being wrong or the rabbit hole of our code being wrong. It would help if I knew what the expected behavior of a slave in Redis Sentinel is, but about two hours of Google has yielded nothing anywhere in the documentation.
Asked
Active
Viewed 187 times
0

Nick Williams
- 2,864
- 5
- 29
- 43
-
See if this helps : https://github.com/antirez/redis/issues/5229 – DhruvPathak Jan 09 '19 at 07:16
-
No, that doesn't appear to be what's going on here. This isn't a replication problem. – Nick Williams Jan 11 '19 at 15:53
1 Answers
0
In my environment with Redis 4.0.1 and read-only slaves, an error is returned right away when setting values:
127.0.0.1:6380> get foo
"hi"
127.0.0.1:6380> set foo bar
(error) READONLY You can't write against a read only slave.
Slaves are read-only by default since Redis 2.6, you may find more info at https://redis.io/topics/replication

whatacold
- 660
- 7
- 15