Fatal error: Uncaught RedisException: MISCONF Redis is configured to save RDB snapshots

3.30K 浏览服务器运维

Fatal error: Uncaught RedisException: MISCONF Redis is configured to save RDB snapshots

报错

Fatal error: Uncaught RedisException: 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解决该问题。

/usr/local/redis/bin# redis-cli 127.0.0.1:6379> config set stop-writes-on-bgsave-error no OK


Add vm.overcommit_memory = 1 to /etc/sysctl.conf and then reboot or run the command sysctl vm.overcommit_memory=1 for this to take effect immediately

如果还不行的话,就是内存不够/磁盘不够的原因,加内存和硬盘 即可解决

或者用下面的方法来试试:

如何关闭redis持久化?我的需求是只把redis当作缓存来用,所以持久化到硬盘对我的需求来说没有意义。

修改redis配置文件,redis.conf 第115行左右。

1.注释掉原来的持久化规则

#save 900 1

#save 300 10

#save 60 10000

2.设置为空

save ""

然后重启redis服务即可。

最后于 4月前 被admin编辑 ,原因:
0