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

查看所有标签

Introduction to the Design and Analysis of Algorithms

Introduction to the Design and Analysis of Algorithms

Anany Levitin / Addison Wesley / 2006-2-24 / USD 122.00

Based on a Based on a new classification of algorithm design techniques and a clear delineation of analysis methods, "Introduction to the Design and Analysis of Algorithms" presents the subject in a c......一起来看看 《Introduction to the Design and Analysis of Algorithms》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具