zoukankan      html  css  js  c++  java
  • springboot2集成redis5报错:io.lettuce.core.RedisException: io.lettuce.core.RedisConnectionException: DENIED Redis is running in protected

    报错信息如下:

      Caused by: io.lettuce.core.RedisException: io.lettuce.core.RedisConnectionException: 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.
    at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java:129)
    at io.lettuce.core.FutureSyncInvocationHandler.handleInvocation(FutureSyncInvocationHandler.java:69)
    at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80)
    at com.sun.proxy.$Proxy84.setex(Unknown Source)
    at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.setEx(LettuceStringCommands.java:230)
    ... 72 more

    报错说得很详细,说明redis是以受保护的模式在运行,没有指定地址,也没有设置密码,只能使用环回接口。 如果想连接外部的计算机,可以采用以下措施之一:

    1.  使用 "CONFIG SET protected-mode no" 设置

    2. 修改redis.conf 配置文件,然后重启服务 

    3. 如果仅是为了测试,在启动redis服务时,加上 “--protected-mode no ”

    ./redis-server ./redis.conf --protected-mode no

    4. 绑定明确的地址,或者设计密码

    经过测试,确实可以!!!

  • 相关阅读:
    OCP-1Z0-051-V9.02-26题
    谨慎使用A2W等字符转换宏
    MySQL 递归查询 当前节点及子节点
    std count_if用法
    OCP-1Z0-053-V12.02-660题
    OCP-1Z0-053-V12.02-667题
    OCP-1Z0-053-V12.02-676题
    OCP-1Z0-051-V9.02-159题
    手工不完全恢复(非归档模式下,日志被覆盖)
    手工完全恢复(非归档模式下,日志没有被覆盖)
  • 原文地址:https://www.cnblogs.com/z-qinfeng/p/11893040.html
Copyright © 2011-2022 走看看