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  權限不懂的話另行百度。

   問題是解決了 ,還有個問題是為什么雲服務器重啟后忽然權限不夠了呢???

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM