做redisSADD myset “hello” 事遇到一个错误
(error) 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配置为保存数据库快照模式,不能持久化到硬盘。
解决办法
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
127.0.0.1:6379> sadd testSet1 a b c d e 1 2 3
(integer) 8
127.0.0.1:6379>
RDB持久化
配置
stop-writes-on-bgsave-error 选项
如果 = yes : redis 会创建一个新的后台进程dump rdb。
假设 :创建快照(硬盘上,产生一个新的rdb文件)需要 20s时间,redis主进程,在这20s内,会继续接受客户端命令,但是,就在这20s,内,创建快照!!!,出错了,比如磁盘满了,那么redis会认为,当前!!!,Redis is configured to save RDB snapshots, but is currently not able to persist on disk. but is currently not able to persist on disk.那么,redis会,拒绝 新的写入,也就是说,它认为,你当下,持久化数据出现了问题,你就不要再set啦。