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.

  

1. 错误原因:由于redis的保护模式开启了,并且没有绑定ip地址,没有密码认证

2. 解决方案
方案一:

1) 使用 设置CONFIG SET protected-mode no

步骤:

1. 在redis本机上打开redis-cli工具,并连接

2. 在其中输入CONFIG SET protected-mode no即可

缺点:

该种方式只是短暂性有效,如果redisServer重新启动后还是不能正常链接

方案二:

1)编辑redis配置文件,将保护模式关闭

步骤:

由于我是直接使用redis-server 命令启动的,所以说其服务是按照其默认设置进行启动,修改/usr/local/etc/redis.conf

如果没有请从下载的redis中复制一个redis.conf到这里,

将bind 后面绑定的ip后面加入你本机外网的ip

bind 127.0.0.1 192.168.21.4

  

然后保存,再使用redis-server /usr/local/etc/redis.conf启动

问题:

  1.redis-cli不能直接使用,必须输入绑定的ip+d端口号才能正常使用

  2.不安全

2). 将redis.conf中安全模式关闭

将该保护模式改为no

再试

缺点:1.保护模式关闭后不安全

3)设置密码访问模式

在redis.conf中加入一行密码设置

require 你的密码

保存,再重新启动redis客户端

以上四种方式解决该错误都可以,但是根据上面的优缺点,

选择第四种方式最佳,安全性最高 

解决使用jedis连接是报DENIED Redis is running in protected mode错误的更多相关文章

  1. 2017.7.10 Redis报错:DENIED Redis is running in protected mode

    参考来自: java 客户端链接不上redis解决方案 DENIED Redis is running in protected mode 完整错误信息: Caused by: redis.clien ...

  2. 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 ...

  3. error) DENIED Redis is running in protected mode because protected mode is enabled报错

    官网地址:https://redis.io/download 官方安装文档如下: Installation Download, extract and compile Redis with: $ wg ...

  4. DENIED Redis is running in protected mode

    1.开源软件往往做的非常出色,错误的时候,会告诉你原因,以及怎么修改,仔细阅读就能明白.比如这个错误: [root@localhost src]# ./redis-cli -h 172.16.2.16 ...

  5. Redis异常 | DENIED Redis is running in protected mode because protected mode is enabled

    背景 今天重新搭了个redis环境,用简单的代码去测试下是否正常, @RunWith(SpringRunner.class) @SpringBootTest public class Springbo ...

  6. (error) DENIED Redis is running in protected mode because protected mode is enabled

    在通过Java程序链接配置好的redis服务时出现 DENIED Redis is running in protected mode because protected mode is enable ...

  7. DENIED Redis is running in protected mode because protected mode is enabled

    DENIED Redis is running in protected mode because protected mode is enabled redisson连接错误 Unable to i ...

  8. 关于Jedis连接Linux上的redis出现 DENIED Redis is running in protected mode问题的解决方案

    redis 添加了requirepass 123456后还是报错,原来是重新启动的时候./redis-cli  没有指定配置文件. https://blog.csdn.net/a532672728/a ...

  9. 【Redis】【报错】redis.exceptions.ResponseError: DENIED Redis is running in protected mode

    (一)报错前提 写flask 项目的时候,因为连接了私有云中的redis地址指定了IP host,启动项目的时候报错 (二)解决方法 首先要切换到root用户 root@:/etc/redis# pw ...

随机推荐

  1. js压箱底的宝贝

    框架的确好用, 不过他们也隐藏了JavaScript中丑陋的细节和DOM的运作机制. 如果你的目标是敢于自称"我懂JavaScript", 那么花时间学习框架无异于南辕北辙. 下面 ...

  2. 2 JAVA 项目名称前红色叹号如何解决

    1 Java 项目前出现红色叹号Eclipse找不到项目需要的JAR包,可以在这里面解决: ① 右键点击项目,选择[Build Path].[Configure Build Path...] ② 在这 ...

  3. [转帖]system()、exec()、fork()三个与进程有关的函数的比较

    system().exec().fork()三个与进程有关的函数的比较 https://www.cnblogs.com/qingergege/p/6601807.html 启动新进程(system函数 ...

  4. Windows 机器上面同时安装mysql5.6 和 mysql5.7 的方法

    1. 自己遇到的两个坑: . mysql 登录的时候 需要使用-P 来指定端口号 不然默认走 呢 . mysql 5.6 和 mysql 5.7 更改用户密码的命令不一样.. 我这边浪费了很长时间: ...

  5. ubuntu18.04 安装 php7.2

    sudo apt-get install software-properties-common python-software-properties sudo add-apt-repository p ...

  6. Python cmd库的简易使用

    简单记录一下,竟然这么简单的方法就能在 python 里面实现一个简单的交互式命令行以前从来没有尝试过. 上一个完整的例子: import cmd import osimport readline r ...

  7. dede:field name=’position’标签调用 主页改成英文Home和改变符号

    在用dede:field name=’position’ 这个标签的时候我们调用的这个就是中文的,出现的是主页>+相应的栏目  ,那么这个问题怎么改成英文的呢?有好多大虾都说找到dede安装目录 ...

  8. 老男孩python学习自修第十一天【内置函数】

    1.基本内置函数 help() 帮助文档 dir() 列出当前文件的所有变量和方法 vars() 列出当前文件的所有变量及其值 type() 返回变量的类型 id() 返回变量的内存地址 len() ...

  9. darknet源码解析

    https://blog.csdn.net/u014540717/article/category/6513159

  10. controller层负责创建类传递类给service;service层负责逻辑编写调用dao层 将编写后的类传递到dao层,保证事务的正确性;dao层负责数据的持久化

    controller层负责创建类传递类给service:service层负责逻辑编写调用dao层 将编写后的类传递到dao层,保证事务的正确性:dao层负责数据的持久化