Caused by: io.lettuce.core.RedisCommandExecutionException: ERR unknown command CONFIG
项目本机启动运行正常,打成jar包发布测试环境–公司测试服务器正常启动运行,项目上线前需要发布在客户购买的亚马逊的K8S服务器,同时客户在亚马逊购买了Redis服务器,PostgreSQL服务器,所以新建了配置文件,将代码构建为镜像推送至客户服务器,然后进行启动编译,连接数据库一切正常,但是到连接Redis时一直报错,开始运维只给了报错截图,报错信息并不全,导致一直找不到具体原因走了许多弯路,也并没有解决问题
截图如下!
通过这张图片一直以为是Redis连接超时问题,以为是Redis设置超时时间太短,一直在修改Redis超时时间,后来发现并没有什么用,后来以为是因为是生产环境,对redis的危险命令进行禁用和重命名,但是经过一番折腾后发现也没什么用,后来让运维发了具体的报错信息,具体信息如下:
Caused by: org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR unknown command CONFIG
, with args beginning with: GET
, notify-keyspace-events
,
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:271)
at org.springframework.data.redis.connection.lettuce.LettuceConnection.await(LettuceConnection.java:1062)
at org.springframework.data.redis.connection.lettuce.LettuceConnection.lambda$doInvoke
4
(
L
e
t
t
u
c
e
C
o
n
n
e
c
t
i
o
n
.
j
a
a
:
919
)
a
t
o
r
g
.
s
r
i
n
g
f
r
a
e
w
o
r
.
a
t
a
.
r
e
i
s
.
c
o
n
n
e
c
t
i
o
n
.
l
e
t
t
u
c
e
.
L
e
t
t
u
c
e
I
n
v
o
e
r
4(LettuceConnection.java:919) at org.springframework.data.redis.connection.lettuce.LettuceInvoker
4(LettuceConnection.java:919)atorg.springframework.data.redis.connection.lettuce.LettuceInvokerSynchronizer.invoke(LettuceInvoker.java:673)
at org.springframework.data.redis.connection.lettuce.LettuceInvoker
D
e
f
a
u
l
t
S
i
n
g
l
e
I
n
v
o
c
a
t
i
o
n
S
p
e
c
.
g
e
t
(
L
e
t
t
u
c
e
I
n
v
o
k
e
r
.
j
a
v
a
:
589
)
a
t
o
r
g
.
s
p
r
i
n
g
f
r
a
e
w
o
r
k
.
d
a
t
a
.
r
e
d
i
s
.
c
o
n
n
e
c
t
i
o
n
.
l
e
t
t
u
c
e
.
L
e
t
t
u
c
e
S
e
r
v
e
r
C
o
m
m
a
n
d
s
.
g
e
t
C
o
n
f
i
g
(
L
e
t
t
u
c
e
S
e
r
v
e
r
C
o
m
m
a
n
d
s
.
j
a
v
a
:
177
)
a
t
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
d
a
t
a
.
r
e
d
i
s
.
c
o
n
n
e
c
t
i
o
n
.
D
e
f
a
u
l
t
e
d
R
e
d
i
s
C
o
n
n
e
c
t
i
o
n
.
g
e
t
C
o
n
f
i
g
(
D
e
f
a
u
l
t
e
d
R
e
d
i
s
C
o
n
n
e
c
t
i
o
n
.
j
a
v
a
:
1416
)
a
t
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
d
a
t
a
.
r
e
d
i
s
.
l
i
s
t
e
n
e
r
.
K
e
y
s
p
a
c
e
E
v
e
n
t
M
e
s
s
a
g
e
L
i
s
t
e
n
e
r
.
i
n
i
t
(
K
e
y
s
p
a
c
e
E
v
e
n
t
M
e
s
s
a
g
e
L
i
s
t
e
n
e
r
.
j
a
v
a
:
89
)
a
t
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
d
a
t
a
.
r
e
d
i
s
.
l
i
s
t
e
n
e
r
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l
R
e
a
d
(
C
o
m
m
a
n
d
H
a
n
d
l
e
r
.
j
a
v
a
:
598
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
i
n
v
o
k
e
C
h
a
n
n
e
l
R
e
a
d
(
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
j
a
v
a
:
379
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
i
n
v
o
k
e
C
h
a
n
n
e
l
R
e
a
d
(
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
j
a
v
a
:
365
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
f
i
r
e
C
h
a
n
n
e
l
R
e
a
d
(
A
b
s
t
r
a
c
t
C
h
a
n
n
e
l
H
a
n
d
l
e
r
C
o
n
t
e
x
t
.
j
a
v
a
:
357
)
a
t
i
o
.
n
e
t
t
y
.
c
h
a
n
n
e
l
.
D
e
f
a
u
l
t
C
h
a
n
n
e
l
P
i
p
e
l
i
n
e
DefaultSingleInvocationSpec.get(LettuceInvoker.java:589) at org.springframework.data.redis.connection.lettuce.LettuceServerCommands.getConfig(LettuceServerCommands.java:177) at org.springframework.data.redis.connection.DefaultedRedisConnection.getConfig(DefaultedRedisConnection.java:1416) at org.springframework.data.redis.listener.KeyspaceEventMessageListener.init(KeyspaceEventMessageListener.java:89) at org.springframework.data.redis.listener.KeyspaceEventMessageListener.afterPropertiesSet(KeyspaceEventMessageListener.java:137) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) … 24 more Caused by: io.lettuce.core.RedisCommandExecutionException: ERR unknown command `CONFIG`, with args beginning with: `GET`, `notify-keyspace–events`, at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:147) at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:116) at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:120) at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:111) at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:746) at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:681) at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:598) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline
DefaultSingleInvocationSpec.get(LettuceInvoker.java:589)atorg.springframework.data.redis.connection.lettuce.LettuceServerCommands.getConfig(LettuceServerCommands.java:177)atorg.springframework.data.redis.connection.DefaultedRedisConnection.getConfig(DefaultedRedisConnection.java:1416)atorg.springframework.data.redis.listener.KeyspaceEventMessageListener.init(KeyspaceEventMessageListener.java:89)atorg.springframework.data.redis.listener.KeyspaceEventMessageListener.afterPropertiesSet(KeyspaceEventMessageListener.java:137)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)…24moreCausedby:io.lettuce.core.RedisCommandExecutionException:ERRunknowncommand‘CONFIG‘,withargsbeginningwith:‘GET‘,‘notify−keyspace−events‘,atio.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:147)atio.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:116)atio.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:120)atio.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:111)atio.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:746)atio.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:681)atio.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:598)atio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)atio.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)atio.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)atio.netty.channel.DefaultChannelPipelineHeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800)
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
报错原因原因是spring-session调用了CONFIG命令来配置Keyspace notifications功能。而线上环境的redis基于权限的考虑,禁止应用服务执行CONFIG命令,这样就导致了应用在初始化时抛出此异常。
具体解决方式如下:
1、打开redis的Keyspace notifications功能,在redis.conf配置文件里添加下面的配置项:
notify-keyspace–events Ex
由于我这边是客户提供海外的k8s服务器,我不能直接进行修改Redis配置文件,所以此方法行不通
2、关闭Spring-session使用CONFIG命令做操作
@Configuration
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 1800)
public class RedisSessionConfig {
@Bean
public static ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP;
}
原文地址:https://blog.csdn.net/weixin_39844149/article/details/128939054
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_33340.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!