我是 Redis 的新手,我试图删除 Ram 上的一个键,但它已经存在于磁盘上的哑文件中。重启服务器后,Ram 上的密钥已经存在。请帮我。如何在内存和磁盘之间同步数据?
问问题
1339 次
2 回答
1
根据您的配置文件,您可以修改您的redis config file
,例如
appendonly yes
appendfsync always
# appendfsync everysec
# append
希望有帮助。
于 2015-09-22T03:09:33.250 回答
1
appendonly yes
appendfsync always
# appendfsync everysec
# append
正如 Javy 所说,这样做肯定会有所帮助,这会启用 aof 并确保 ram 中的数据每秒同步到磁盘。另一种方法是发出 BGSAVE 命令以立即生成新的 dump.rdb 文件。我认为您应该修改自动转储执行的频率。这是在 redis.conf 中。查看项目保存。
猜猜我最好为你发布相关段落:
################################ SNAPSHOTTING ################################
#
# Save the DB on disk:
#
# save <seconds> <changes>
#
# Will save the DB if both the given number of seconds and the given
# number of write operations against the DB occurred.
#
# In the example below the behaviour will be to save:
# after 900 sec (15 min) if at least 1 key changed
# after 300 sec (5 min) if at least 10 keys changed
# after 60 sec if at least 10000 keys changed
#
# Note: you can disable saving completely by commenting out all "save" lines.
#
# It is also possible to remove all the previously configured save
# points by adding a save directive with a single empty string argument
# like in the following example:
#
# save ""
如果您不知道如何更改配置文件,请按指定顺序键入以下命令:
config set appendonly yes
config set appendonly everysec
config rewrite
如果有什么不明白的,欢迎回复。
于 2015-09-22T06:15:20.690 回答