Redis是一个开源的内存键值对存储数据库,它支持多种数据结构、分布式、持久化

问题

#log

1.执行清库操作
flushdb

2.日志提示
(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.

“WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.”

警告:过量使用内存设置为0!在低内存环境下,后台保存可能失败

解决

1.低内存解决(建议扩容内存及redis设置合理的内存占用)
sysctl vm.overcommit_memory=1
or
vim /etc/sysctl.conf                       
vm.overcommit_memory = 1
sysctl  -a

2.异常信息磁盘写停止(建议默认开启,出现异常要解决...)
# However if you have setup your proper monitoring of the Redis server
# and persistence, you may want to disable this feature so that Redis will
# continue to work as usual even if there are problems with disk,
# permissions, and so forth.
stop-writes-on-bgsave-error yes    ###默认,遇到异常停止写数据

root@ubuntu:/usr/local/redis/bin# ./redis-cli
127.0.0.1:6379> config set stop-writes-on-bgsave-error no   //临时修改,永久解决修改redis.conf
OK
127.0.0.1:6379> lpush myColour "red"      //测试是否可以写数据
(integer) 1    
set test  "hello,OK" 
get test

vim  redis.conf                   
stop-writes-on-bgsave-error no //永久性生效