Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERR Client sent AUTH, but no password is set

I am using jedis 2.8.0 and getting following exception:

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

Following is the api I am using:

jedisPool = new JedisPool(jedisPoolConfig, host, port, IDLE_CONNECTION_TIMEOUT, authSecret); 

Notes:

  1. I am able to successfully send commands to redis using the exact same password using the redis-cli -a option.
  2. I also printed the password in the logs to see if I am sending wrong password, but the password passed to JedisPool is proper.
  3. I also tried to "redis-cli monitor" calls on redis but I dont see any AUTH request.
like image 769
user1619355 Avatar asked Jun 16 '17 21:06

user1619355


1 Answers

There is no password set in your Redis instance. Password sent with redis-cli -a is just being ignored.

Now, you may set the password in redis instance. To do so, edit redis configuration file, set requirepass option and restart redis instance.

Or, just ignore password option while communicating with redis. E.g.

jedisPool = new JedisPool(jedisPoolConfig, host, port, IDLE_CONNECTION_TIMEOUT);
like image 54
sazzad Avatar answered Nov 04 '22 05:11

sazzad