1. 程式人生 > 實用技巧 >MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk

MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk

報錯日誌:

2020-10-22 17:14:57,140 ERROR [com.asion.business.web.advice.ExceptionAdvice:37] - Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: 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. org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: 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.

caused by :

Caused by: io.lettuce.core.RedisCommandExecutionException: 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.
        at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:
118) at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:109) at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:598) at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:556) at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:508) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:647) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:582) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:499) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ... 1 common frames omitted

日誌內容:Redis被配置為儲存資料庫快照,但它目前不能持久化到硬碟。用來修改集合資料的命令不能用。請檢視Redis日誌的詳細錯誤資訊。

redis快照被強制關閉了導致不能持久化。

首先檢視redis伺服器上的磁碟是否滿了和其對磁碟的訪問許可權是否不足。

此次報錯為磁碟空間不足

網上搜索到的解決辦法多為 將redis的 stop-writes-on-bgsave-error值設定為no(未嘗試)

命令列修改:

127.0.0.1:6379> config set stop-writes-on-bgsave-error no

重啟redis-server

redis.conf檔案中修改如下配置:

將stop-writes-on-bgsave-error 這一配置項修改為“no”,即在伺服器磁碟出現問題時不會停止redis的寫入操作