redis 常见问题
Last updated on November 20, 2024 am
🧙 Questions
☄️ Ideas
问题1
org.springframework.data.redis.RedisSystemException: Redis command interrupted; nested exception is io.lettuce.core.RedisCommandInterruptedException: Command interrupted
at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:62) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java:270) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.connection.lettuce.LettuceHashCommands.convertLettuceAccessException(LettuceHashCommands.java:471) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.connection.lettuce.LettuceHashCommands.hSet(LettuceHashCommands.java:71) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.connection.DefaultedRedisConnection.hSet(DefaultedRedisConnection.java:1020) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.core.DefaultHashOperations.lambda$put$9(DefaultHashOperations.java:192) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:228) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:188) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:96) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.data.redis.core.DefaultHashOperations.put(DefaultHashOperations.java:191) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at com.definesys.ispong.admin.moudle.monitor.yarn.YarnClusterServerStatusListener.lambda$null$7(YarnClusterServerStatusListener.java:333) ~[classes!/:3.2.1-rc.bugfix.1695+1669dd89]
at java.util.concurrent.ConcurrentHashMap.computeIfPresent(ConcurrentHashMap.java:1769) ~[na:1.8.0_202]
at com.definesys.ispong.admin.moudle.monitor.yarn.YarnClusterServerStatusListener.lambda$updateAllApplication$8(YarnClusterServerStatusListener.java:314) ~[classes!/:3.2.1-rc.bugfix.1695+1669dd89]
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[na:1.8.0_202]
at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1628) ~[na:1.8.0_202]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[na:1.8.0_202]
at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291) ~[na:1.8.0_202]
at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731) ~[na:1.8.0_202]
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[na:1.8.0_202]
at java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:401) ~[na:1.8.0_202]
at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:734) ~[na:1.8.0_202]
at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:160) ~[na:1.8.0_202]
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:174) ~[na:1.8.0_202]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233) ~[na:1.8.0_202]
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[na:1.8.0_202]
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:583) ~[na:1.8.0_202]
at com.definesys.ispong.admin.moudle.monitor.yarn.YarnClusterServerStatusListener.updateAllApplication(YarnClusterServerStatusListener.java:295) ~[classes!/:3.2.1-rc.bugfix.1695+1669dd89]
at com.definesys.ispong.admin.moudle.monitor.yarn.YarnClusterServerStatusListener.lambda$null$0(YarnClusterServerStatusListener.java:95) ~[classes!/:3.2.1-rc.bugfix.1695+1669dd89]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_202]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_202]
Caused by: io.lettuce.core.RedisCommandInterruptedException: Command interrupted
at io.lettuce.core.protocol.AsyncCommand.await(AsyncCommand.java:87) ~[lettuce-core-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java:112) ~[lettuce-core-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
at io.lettuce.core.FutureSyncInvocationHandler.handleInvocation(FutureSyncInvocationHandler.java:69) ~[lettuce-core-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80) ~[lettuce-core-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
at com.sun.proxy.$Proxy108.hset(Unknown Source) ~[na:na]
at org.springframework.data.redis.connection.lettuce.LettuceHashCommands.hSet(LettuceHashCommands.java:69) ~[spring-data-redis-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
... 26 common frames omitted
Caused by: java.lang.InterruptedException: null
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:347) ~[na:1.8.0_202]
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) ~[na:1.8.0_202]
at io.lettuce.core.protocol.AsyncCommand.await(AsyncCommand.java:83) ~[lettuce-core-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
... 31 common frames omitted
修改spring中lettuce的配置
spring:
redis:
host: localhost # 地址
port: 6379 # 端口号
database: 0 # 数据库
timeout: 60000 # 连接超时时间,单位为毫秒,60秒
lettuce:
pool:
max-active: 100 # 最大连接数,连接池中能够分配的最大连接数。如果设置为 -1,则表示无限制。默认8
max-idle: 50 # 最大空闲连接数,连接池中保持空闲的最大连接数。默认8
min-idle: 20 # 最小空闲连接数,连接池中保持空闲的最小连接数。默认0
max-wait: -1ms # 最大等待时间,单位为毫秒。当连接池没有可用连接时,客户端调用获取连接的最大等待时间。如果设置为 -1,则表示无限制。默认-1
time-between-eviction-runs: 60000ms # 空闲连接驱逐检查的时间间隔,单位为毫秒。当设置为正值时,表示每隔多少毫秒进行一次空闲连接的检查。1分钟
shutdown-timeout: 1000ms # 关闭超时时间,单位为毫秒,默认100毫秒
🔗 Links
redis 常见问题
https://ispong.isxcode.com/spring/redis/redis 常见问题/