Search code examples
redisreplicationmaster-slave

How to make Redis slave read only in Redis v2.4.6?


I used slave-read-only yes in redis.conf file.

CONFIG SET "slave-read-only" "yes"
(error) ERR Unsupported CONFIG parameter: slave-read-only

How to set the same?


Solution

  • From Redis documentation:

    Since Redis 2.6, slaves support a read-only mode that is enabled by default. This behavior is controlled by the slave-read-only option in the redis.conf file, and can be enabled and disabled at runtime using CONFIG SET.

    For any Redis version earlier than 2.6, slave-read-only parameter was not available (and thus not recognized). So, in Redis v2.4.6, you will not be able to set that parameter.