我是靠谱客的博主 小巧鸵鸟,最近开发中收集的这篇文章主要介绍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.


最后

以上就是小巧鸵鸟为你收集整理的redis 报错的全部内容,希望文章能够帮你解决redis 报错所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(62)

评论列表共有 0 条评论

立即
投稿
返回
顶部