(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk.

今天运行Redis时发生错误,错误信息如下:

(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

Redis被配置为保存数据库快照,但它目前不能持久化到硬盘。用来修改集合数据的命令不能用。请查看Redis日志的详细错误信息。

原因:

强制关闭Redis快照导致不能持久化。

解决方案:

运行config set stop-writes-on-bgsave-error no 命令后,关闭配置项stop-writes-on-bgsave-error解决该问题。

root@ubuntu:/usr/local/redis/bin# ./redis-cli
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
127.0.0.1:6379> lpush myColour "red"
(integer) 1

2、问题MISCONF Redis is configured to save RDB snapshots

127.0.0.1:6379> set k1 "nob"

(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

出现如上错误是因为磁盘无法写入,缘由:应该是之前强制停止redis快照导致

我的解囧,重启机器没问题了,哈哈哈,就是因为几次强制停止造成的

有人的解囧如下

config set stop-writes-on-bgsave-error no

如果是内存问题应该如下办法,具体查看日志,

请在/etc/sysctl.conf 添加一项 'vm.overcommit_memory = 1' ,然后重启(或者运行命令'sysctl vm.overcommit_memory=1' )使其生效。

这个错误信息是Redis客户端工具在保存数据时候抛出的异常信息。

百度查了一下,很多人都是建议“config set stop-writes-on-bgsave-error no”;这样做其实是不好的,这仅仅是让程序忽略了这个异常,使得程序能够继续往下运行,但实际上数据还是会存储到硬盘失败!

彻底的、正确解决方法:

第一步:打开/etc/sysctl.conf ;

第二步:在文件最底部添加一条'vm.overcommit_memory = 1' ;

第三步:运行命令"sysctl vm.overcommit_memory=1"使其生效;

第四步:重启服务器;

第五步:彻底搞定。

如果还是解决不了,只有用以下办法了:

(1)关闭redis快照功能;

(2)daemonize 设置为no

原文地址:https://www.cnblogs.com/tianciliangen/p/7503552.html