我正在使用jedis 2.8.0并获得以下异常:
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
at redis.clients.jedis.Protocol.processError(Protocol.java:123)
at redis.clients.jedis.Protocol.process(Protocol.java:157)
at redis.clients.jedis.Protocol.read(Protocol.java:211)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297)
at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:196)
at redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2049)
at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:89)
at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:458)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
at redis.clients.util.Pool.getResource(Pool.java:49)
... 4 more
以下是我正在使用的api:
jedisPool = new JedisPool(jedisPoolConfig, host, port, IDLE_CONNECTION_TIMEOUT, authSecret);
注意:
答案 0 :(得分:7)
Redis
个实例中未设置密码。使用redis-cli -a
发送的密码将被忽略。
现在,您可以在redis实例中设置密码。为此,请编辑redis配置文件,设置requirepass
选项并重新启动redis实例。
或者,在与redis通信时忽略密码选项。 E.g。
jedisPool = new JedisPool(jedisPoolConfig, host, port, IDLE_CONNECTION_TIMEOUT);
答案 1 :(得分:-1)