Redis Config rewrite 命令

Redis 教程 · 2019-03-08 16:42:08

Redis Config rewrite 命令对启动 Redis 服务器时所指定的 redis.conf 配置文件进行改写。

CONFIG SET 命令可以对服务器的当前配置进行修改, 而修改后的配置可能和 redis.conf 文件中所描述的配置不一样, CONFIG REWRITE 的作用就是通过尽可能少的修改, 将服务器当前所使用的配置记录到 redis.conf 文件中。

语法

redis Config rewrite 命令基本语法如下:

redis 127.0.0.1:6379> CONFIG REWRITE parameter

可用版本

>= 2.8.0

返回值

一个状态值:如果配置重写成功则返回 OK ,失败则返回一个错误。

实例

以下是执行 CONFIG REWRITE 前, 被载入到 Redis 服务器的 redis.conf 文件中关于 appendonly 选项的设置:

# ... 其他选项

appendonly no

# ... 其他选项

在执行以下命令之后:

127.0.0.1:6379> CONFIG GET appendonly           # appendonly 处于关闭状态
1) "appendonly"
2) "no"

127.0.0.1:6379> CONFIG SET appendonly yes       # 打开 appendonly
OK

127.0.0.1:6379> CONFIG GET appendonly
1) "appendonly"
2) "yes"

127.0.0.1:6379> CONFIG REWRITE                  # 将 appendonly 的修改写入到 redis.conf 中
OK

重写后的 redis.conf 文件中的 appendonly 选项将被改写:

# ... 其他选项

appendonly yes

# ... 其他选项

点击查看所有 Redis 教程 文章: https://www.codercto.com/courses/l/33.html

查看所有标签

PHP Cookbook

PHP Cookbook

Adam Trachtenberg、David Sklar / O'Reilly Media / 2006-08-01 / USD 44.99

When it comes to creating dynamic web sites, the open source PHP language is red-hot property: used on more than 20 million web sites today, PHP is now more popular than Microsoft's ASP.NET technology......一起来看看 《PHP Cookbook》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

SHA 加密
SHA 加密

SHA 加密工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试