環境:3.0.7 redis八節點集羣4主4從 開發測試環境
操作:清除集羣持久化數據
#redis-cli -c -p 6383 -h 172.31.103.238 登陸之後
cluster nodes 察看節點信息 登陸master節點進行刪除 flushall
在其中一個節點執行時抱錯:
172.31.103.238:6383> flushdb
(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時發生錯誤,錯誤信息如下:
(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
察看自己配置文件:
stop-writes-on-bgsave-error yes
雖然是測試環境但是沒有立刻修改,登陸到相應節點上
df -h 察看root滿了
[root@VM-172-31-103-238 /]#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda3 35G 35G 0 100% /
查找到罪魁禍首是開發搞的日誌文件33g
確認之後刪除之
刪除之後察看
[root@VM-172-31-103-238 /]#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda3 35G 35G 0 100% /
沒有釋放
[root@VM-172-31-103-238 /]#lsof | grep delete
java 21037 root 1w REG 252,3 35273113600 395356 /opt/server/logs/catalina.out (deleted)
java 21037 root 2w REG 252,3 35273113600 395356 /opt/server/logs/catalina.out (deleted)
[root@VM-172-31-103-238 /]#kill -9 21037
[root@VM-172-31-103-238 /]#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda3 35G 2.0G 32G 6% /
再次執行
[root@VM-172-31-103-73 /cluster]#redis-cli -c -p 6383 -h 172.31.103.238
172.31.103.238:6383> flushall
OK