前言
Redis突然鏈接不上了...
解決方案
#docker 進入redis容器中,其中"f0dd"為redis容器的id開始四位
[root@iZ2zeca7jric8sx4f3n7spZ ~]# docker exec -it f0dd /bin/bash
#錯誤示例-Begin,已經忘了redis命令是啥了...
root@f0dd1681b64f:/data# get
bash: get: command not found
root@f0dd1681b64f:/data# key
bash: key: command not found
root@f0dd1681b64f:/data# redis
bash: redis: command not found
#錯誤示例-End,已經忘了redis命令是啥了...
#進入客戶端(redis client)
root@f0dd1681b64f:/data# redis-cli
#寫入一個鍵值
127.0.0.1:6379> set name zf
#報錯信息
(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.
#解決命令
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
#驗證錯誤是否解決
127.0.0.1:6379> set name zf
OK