Get the App
SLTechnology News&Howtos  ›  Servers  › 

Redis persistence problem handling

Shulou Source: shulou.com Published: 2022-06-03 10:23:58 10月02日 Update

This is a recent problem encountered in the development process, because the need to frequently use redis as an intermediate query operation, suddenly failed, the service was aborted, and an exception was thrown

2020-01-09 09 o.z.p.spring.web.advice.AdviceTrait 34 o.z.p.spring.web.advice.AdviceTrait 17.848 ERROR 25703-[XNIO-2 task-83] o.z.p.spring.web.advice.AdviceTrait: Internal Server Errororg.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. At org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert (LettuceExceptionConverter.java:54) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert (LettuceExceptionConverter.java:52) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert (LettuceExceptionConverter.java:41) at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate (PassThroughExceptionTranslationStrategy.java:44) at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate (FallbackExceptionTranslationStrategy.java:42) at org. Springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException (LettuceConnection.java:257) at org.springframework.data.redis.connection.lettuce.LettuceHashCommands.convertLettuceAccessException (LettuceHashCommands.java:445) at org.springframework.data.redis.connection.lettuce.LettuceHashCommands.hSet (LettuceHashCommands.java:70) at org.springframework.data.redis.connection.DefaultedRedisConnection.hSet (DefaultedRedisConnection.java:827) at org.springframework.data.redis.connection.DefaultStringRedisConnection.hSet (DefaultStringRedisConnection.java:501) at org .springframework.data.redis.core.DefaultHashOperations.lambda $put$8 (DefaultHashOperations.java:178) at org.springframework.data.redis.core.RedisTemplate.execute (RedisTemplate.java:224) at org.springframework.data.redis.core.RedisTemplate.execute (RedisTemplate.java:184) at org.springframework.data.redis.core.AbstractOperations.execute (AbstractOperations.java:95) at org.springframework.data.redis.core.DefaultHashOperations.put (DefaultHashOperations.java:177) at com.smpteam.aaaa. Service.impl.RedisServiceImpl.setESSession (RedisServiceImpl.java:59) at com.smpteam.aaaa.service.impl.RedisServiceImpl$$FastClassBySpringCGLIB$$11b51629.invoke () at org.springframework.cglib.proxy.MethodProxy.invoke (MethodProxy.java:204). . .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.

Then I logged into the redis server through redis-cli to check the situation and found that ping was not available.

(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.

This tip is very friendly. It's long, but I like it:)

Redis problem

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.

Redis is configured to hold database snapshots, but it cannot be persisted to the hard disk at this time. The command used to modify the collection data cannot be used. Please check the Redis log for detailed error messages.

Reason

Force closing Redis snapshots so that they cannot be persisted. In essence, it is caused by insufficient memory. Therefore, related memory processing is required:

Modify redis config modify the directory of snapshot backups, redirect the snapshot to another directory to modify host memory configuration solution 1

Set stop-writes-on-bgsave-error to no, which is done by directly closing and saving persistent snapshots

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

There may be some problems in production, but this method does not cure the root of the problem. It just asks us to "ignore" him. Before using it, we need to confirm the reason for the failure of bgsave. For example, when redis is used for caching and session scenarios, this is allowed.

Solution 2

Redirect the backed-up rdb file to a directory

CONFIG SET dir / tmp/some/directory/other/than/varCONFIG SET dbfilename temp.rdb

After using this command, you need to make sure that bgsave_in_progress returns a result of 0

Solution 3

Dynamically modify kernel running parameters while the kernel is running

Echo 'vm.overcommit_memory=1' > > / etc/sysctl.confsysctl vm.overcommit_memory=1

Tags: Snapshots problems memory solutions directories solutions kernels causes commands backups data services running configuration processing frequent palliative host production information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux vpn Microsoft MySQL macOS