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.


要解决Docker启动Redis报错的问题,可以尝试以下两种方法: 方法一:设置stop-writes-on-bgsave-error值为no 1. 打开配置文件emqx_auth_redis.conf,配置redis连接地址。 2. 进入解压目录,执行docker build .来生成镜像。 3. 执行docker run命令启动服务,并指定端口号,例如:docker run --name emqx -p 1883:1883 -p 8883:8883 -p 18083:18083 -d 镜像ID。 4. 登录Redisredis-cli -h 127.0.0.1 -p 6379 5. 在Redis命令行中执行config set stop-writes-on-bgsave-error no来设置stop-writes-on-bgsave-error的值为no。 方法二:修改redis.conf配置文件 1. 使用vim打开Redis的配置文件redis.conf。 2. 找到stop-writes-on-bgsave-error这一行的配置项。 3. 将yes修改为no。 4. 保存并关闭文件。 5. 重启Redis服务,使修改的配置生效。 通过以上两种方法中的任意一种,您应该能够解决Docker启动Redis报错的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [docker dockerFile 一键部署 emqx](https://download.csdn.net/download/qq_39231899/82331253)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [docker中启动redis整合Springboot提示错误解决方案](https://blog.csdn.net/administratop/article/details/126498441)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值