Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option)

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

org.springframework.dao.InvalidDataAccessApiUsageException: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.; nested exception is redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB 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

但是 重点来了 

  敲黑板啦

上面的解决办法只能治标,最终还要治本

一、 首先到linux 查看redis 的日志文件

        1.找到redis 配置文件 redis.conf

       输入    find . -name "redis.conf"   查找配置文件路径

 我的在etc 文件夹下 你的就不一定了

 打开redis.conf 文件全局搜索 logfile 查看日志文件地址

 

  根据地址找到redis.log 打开查找日志打印 我的是这个鬼东西

 

  dir /etc/cron.d   这个文件权限不够导致写入错误  好啦找问题之所在了

  既然权限不够 就赋予他权限 cron.d 是个文件夹 我就将整个文件夹及里面统一赋予权限755 依然是权限不够 只能在高了777 搞定了

   赋予权限的语句是 chmod -R 777 cron.d  权限不懂的话另行百度。

   问题是解决了 ,还有个问题是为什么云服务器重启后忽然权限不够了呢???

 

 

 

posted @ 2018-11-12 16:47  Mr.DongYang  阅读(6541)  评论(0编辑  收藏  举报