redis 報錯

解決:

redis通過屬性requirepass 設置訪問密碼,但沒有設置該屬性時,客戶端向服務端發送AUTH請求就會出現最上面的異常 ,所以解決辦法就是 指定配置文件進行啓動。

添加

391  requirepass "5vwJ4AghYNH&W4RWejfieo69C2ZPp%r@"



20:20:00 INFO com.qiji.quartz.OnlineUserQuartz - 定時寫police同步文件開始。。。

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
    at redis.clients.util.Pool.getResource(Pool.java:22)
    at com.qiji.utils.redis.RedisPoolUtil.getJedis(RedisPoolUtil.java:85)
    at com.qiji.utils.redis.RedisPoolUtil.get(RedisPoolUtil.java:190)
    at com.qiji.quartz.OnlineUserQuartz.policeFile(OnlineUserQuartz.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:318)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:111)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
    at redis.clients.jedis.Protocol.processError(Protocol.java:55)
    at redis.clients.jedis.Protocol.process(Protocol.java:62)
    at redis.clients.jedis.Protocol.read(Protocol.java:127)
    at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:162)
    at redis.clients.jedis.Jedis.auth(Jedis.java:1955)
    at redis.clients.jedis.JedisPool$JedisFactory.makeObject(JedisPool.java:66)
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
    at redis.clients.util.Pool.getResource(Pool.java:20)
    ... 12 more
20:20:00 ERROR com.qiji.utils.redis.RedisPoolUtil - null
java.lang.NullPointerException
    at com.qiji.utils.redis.RedisPoolUtil.get(RedisPoolUtil.java:192)
    at com.qiji.quartz.OnlineUserQuartz.policeFile(OnlineUserQuartz.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:318)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:111)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:216)

    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)


2、

391 # requirepass foobared
392 requirepass "5vwJ4AghYNH&W4RWejfieo69C2ZPp%r@"

報這個錯可能是設置密碼的時候 多出空格

Caused by: redis.clients.jedis.exceptions.JedisDataException: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients.

 In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions:
 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent.
 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server.
 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option.
 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章