在应用日志中发现 StackExchange.Redis 在连接 redis 服务时报下面的错误,请问如何解决?
StackExchange.Redis.RedisServerException: 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.
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 2826
查看 redis 日志,看看是是否是写权限问题或者磁盘满了
Please check the Redis logs for details about the RDB error.
磁盘空间没有满
是 redis 内存耗尽引起的
查看 redis 日志发现下面的错误
Write error saving DB on disk: Cannot allocate memory
运行 docker stats
发现 redis 容器已经达到最大内存限制,增加了内存限制,问题就解决了