I want to mark a standalone Redis server (not a Redis-Cluster, not a Redis-Sentinel) as read-only. I have been googling for this for quite sometime but I don't seem to find a definite answer (Almost all answers point to Clustering or Sentinel). I was looking out for some config modification (CONFIG SET something
).
NOTE: config set replica-read-only yes
does not make the current redis-server read-only, but only its replicas.
My use-case basically is I am doing a migration wherein at some point I want to make the redis-server read-only. My application code can handle failures whenever a write call happens so that's not an issue.
Also, if this is not directly possible from redis server, is there something that I can do in the client code that'll have the same effect (I am using redis-py as the client library)? (Although this is less than ideal)
config set replica-read-only yes
and other configs. They don't seem to be applying the current redis-server.Once the writes are done and you want to switch the node to read-only, couple of ways to do that:
However, please note that after modifying redis.conf, you will have to restart your redis node for the changes to take effect.