问题描述
在写入 Redis ( SET foo bar
) 期间,我收到以下错误:
During writes to Redis ( SET foo bar
) I am getting the following error:
MISCONF Redis 配置为保存 RDB 快照,但当前无法在磁盘上持久化.可以修改数据集的命令是禁用.有关错误的详细信息,请检查 Redis 日志.
基本上我理解的问题是redis无法将数据保存在磁盘上,但不知道如何摆脱这个问题.
Basically I understand that the problem is that redis is not able to save data on the disk, but have no idea how to get rid of the problem.
还有下面的问题也有同样的问题,就是很久以前就放弃了,没有答案,很可能没有尝试解决问题.
Also the following question has the same problem, it is abandoned long time ago with no answers and most probably no attempts to solve the problem.
推荐答案
如果在运行的redis实例上遇到错误,一些重要的数据不能丢弃(rdb
文件的权限问题)或者它的目录不正确,或者磁盘空间不足),你总是可以将 rdb
文件重定向到其他地方.
In case you encounter the error and some important data cannot be discarded on the running redis instance (problems with permissions for the rdb
file or its directory incorrectly, or running out of disk space), you can always redirect the rdb
file to be written somewhere else.
使用 redis-cli
,你可以这样做:
Using redis-cli
, you can do something like this:
CONFIG SET dir /tmp/some/directory/other/than/var
CONFIG SET dbfilename temp.rdb
此后,您可能需要执行 BGSAVE
命令以确保将数据写入 rdb
文件.确保在执行INFO persistence
时,bgsave_in_progress
已经是0
并且rdb_last_bgsave_status
是ok代码>.之后,您现在可以开始将生成的
rdb
文件备份到安全的地方.
After this, you might want to execute a BGSAVE
command to make sure that the data will be written to the rdb
file. Make sure that when you execute INFO persistence
, bgsave_in_progress
is already 0
and rdb_last_bgsave_status
is ok
. After that, you can now start backing up the generated rdb
file somewhere safe.
这篇关于MICONF Redis 配置为保存RDB 快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!