1. 程式人生 > >redis:Unable to validate object ;Could not get a resource from the pool;(error) MISCONF Redis is con

redis:Unable to validate object ;Could not get a resource from the pool;(error) MISCONF Redis is con

原因:
強制關閉Redis快照導致不能持久化。

解決方式:
登入redis :

redis-cli
127.0.0.1:6379>config set stop-writes-on-bgsave-error no
ok

解決 !

參考文章:

下面是場景敘述: 選看.

最近線上環境老是redis連線異常Could not get a resource from the pool 首先想到的redis掛了 然後去檢查redis 服務,沒有掛,看連線數,正常…

接著使用info指令看輸出資訊,正常….

然後使用top指令看記憶體使用情況,是不是記憶體不夠了,正常.不過這個正常是有問題的,因為想起來我是剛剛啟動了redis , 記憶體使用率在40% . 然後去看redis輸出日誌發現redis申請記憶體時失敗了,也就是說出現了儲存資料過多導致記憶體爆滿的情況.

出現問題的第一反應是先解決問題嘛,然後再去找原因,我重新啟動了redis , 然後服務正常. 但是過了幾分鐘之後又掛了.很鬱悶…

然後開始仔細檢查tomcat輸出的日誌錯誤資訊, 然後看到了這個
Unable to validate object
好,然後按照這個線索去網上搜索找到了解決方案:

登入到redis然後ping出現
(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-cli
127.0.0.1:6379>config set stop-writes-on-bgsave-error no
ok

解決 !