I have a redis-server instance that is a replica of a primary redis-server instance. Also I have a python3 script that uses the redis library to query the replica instance.
However, this script also tries to inserts data using SET. I'm not sure if it successfully inserts or not.
What happens when you use SET on a replica? My understanding is that a replica is supposed to replicate the data of the redis-server instance, so I can only imagine three possible behaviors
I can't find any documentation on this question, and it seems like all three behaviors would be reasonable. If you know what the behavior is, can you please explain why that is the case as opposed to the other two cases?
Does it pass your SET command up to the primary redis-server instance?
NO
Does it keep your data but only locally?
It depends.
replica-read-only no
, it will accept write operation, and keep the data locally. However, when syncing with master, master's copy will overwrite it.replica-read-only yes
, it will refuse write operation.Does it just ignore your SET command?
NO. It either accepts it or refuses it and returns an error reply.