1. 程式人生 > >Redis中 ERR Client sent AUTH, but no password is set異常

Redis中 ERR Client sent AUTH, but no password is set異常

使用Java連線Redis伺服器的時候發生該錯誤,提示ERR Client sent AUTH, but no password is set

Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
    at redis.clients.jedis.Protocol.processError(Protocol.java:127) ~[jedis-2.9.0.jar:na]
    at redis.clients.jedis.Protocol
.process(Protocol.java:161) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.Protocol.read(Protocol.java:215) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java
:239) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2139) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:108) ~[jedis-2.9.0.jar:na] at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868) ~[commons-pool2-2.4
.2.jar:2.4.2] at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435) ~[commons-pool2-2.4.2.jar:2.4.2] at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363) ~[commons-pool2-2.4.2.jar:2.4.2] at redis.clients.util.Pool.getResource(Pool.java:49) ~[jedis-2.9.0.jar:na] ... 128 common frames omitted

解決

是因為 Redis 伺服器沒有設定密碼,但是客戶端傳送了AUTH請求,所以發生了該異常;

可以使用如下方式啟動

1 指定配置檔案

redis-server /etc/redis/redis.conf

2 不指定配置檔案(無密碼)

redis-server