一、异常说明
通过org.redisson的 redisson 客户端代码连接redis报错误异常“ org.redisson.client.RedisException: ERR unknown command 'EVAL'. channel: [id: 0xb34635ff, L:/127.0.0.1:61042 - R:localhost/127.0.0.1:6379] command: (EVAL), params: [local size = redis.call('hget', KEYS[1], 'size');local hashIterations = redis.call('hget', KEYS[1], ..., 1, {BF:name}:config, 72984, 5] ”日志
log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).@b@log4j:WARN Please initialize the log4j system properly.@b@log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.@b@Exception in thread "main" org.redisson.client.RedisException: ERR unknown command 'EVAL'. channel: [id: 0xb34635ff, L:/127.0.0.1:61042 - R:localhost/127.0.0.1:6379] command: (EVAL), params: [local size = redis.call('hget', KEYS[1], 'size');local hashIterations = redis.call('hget', KEYS[1], ..., 1, {BF:name}:config, 72984, 5]@b@ at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:361)@b@ at org.redisson.client.handler.CommandDecoder.decodeCommandBatch(CommandDecoder.java:265)@b@ at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:207)@b@ at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:134)@b@ at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:104)@b@ at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)@b@ at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)@b@ at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)@b@ at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)@b@ at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)@b@ at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)@b@ at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)@b@ at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)@b@ at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)@b@ at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)@b@ at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)@b@ at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)@b@ at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)@b@ at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)@b@ at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)@b@ at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)@b@ at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)@b@ at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)@b@ at java.lang.Thread.run(Thread.java:745)
二、解决方法
redis版本必须大于等于2.6.0,换成高版本redis即可解决异常
如果版本没问题,打开redis.conf配置文件@b@检查是否有rename-command EVAL ""这项配置@b@如果有,注释掉#rename-command EVAL "",重启redis即可