环境: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