首页 > 解决方案 > 如何在 Redis v2.4.6 中使 Redis slave 只读?

问题描述

redis.conf我在文件中使用了 slave-read-only yes 。

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

怎么设置一样?

标签: redisreplicationmaster-slave

解决方案


Redis 文档

从 Redis 2.6 开始,slave 支持默认启用的只读模式。此行为由slave-read-onlyredis.conf 文件中的选项控制,并且可以在运行时使用 CONFIG SET 启用和禁用。

对于任何早于 2.6 的 Redis 版本,slave-read-only参数不可用(因此无法识别)。因此,在 Redis v2.4.6 中,您将无法设置该参数。


推荐阅读