解决使用jedis连接是报DENIED Redis is running in protected mode错误
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错误的更多相关文章
- 2017.7.10 Redis报错:DENIED Redis is running in protected mode
参考来自: java 客户端链接不上redis解决方案 DENIED Redis is running in protected mode 完整错误信息: Caused by: redis.clien ...
- 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 ...
- 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 ...
- DENIED Redis is running in protected mode
1.开源软件往往做的非常出色,错误的时候,会告诉你原因,以及怎么修改,仔细阅读就能明白.比如这个错误: [root@localhost src]# ./redis-cli -h 172.16.2.16 ...
- Redis异常 | DENIED Redis is running in protected mode because protected mode is enabled
背景 今天重新搭了个redis环境,用简单的代码去测试下是否正常, @RunWith(SpringRunner.class) @SpringBootTest public class Springbo ...
- (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 ...
- 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 ...
- 关于Jedis连接Linux上的redis出现 DENIED Redis is running in protected mode问题的解决方案
redis 添加了requirepass 123456后还是报错,原来是重新启动的时候./redis-cli 没有指定配置文件. https://blog.csdn.net/a532672728/a ...
- 【Redis】【报错】redis.exceptions.ResponseError: DENIED Redis is running in protected mode
(一)报错前提 写flask 项目的时候,因为连接了私有云中的redis地址指定了IP host,启动项目的时候报错 (二)解决方法 首先要切换到root用户 root@:/etc/redis# pw ...
随机推荐
- 文件搜索神器之everything
之前我提到了,在本地快速的进行文件的检索是平常工作中必要的部分,一个好的搜索软件会大大的提升我们的工作效率.就是它,everything,官方的网站地址是http://www.voidtools.co ...
- 三、taro路由及设计稿及尺寸单位
一.路由配置 路由配置跟小程序一样,在入口文件的 config 配置中指定好 pages 通过taro API 跳转,详见导航 // 跳转到目的页面,打开新页面 Taro.navigateTo({ u ...
- C调用C++, C++调用C方法
1. C 调用 C++封装好后的函数: -> 在C++中有一个函数 int main_cpp(): -> 首先构建头文件, #ifndef CPP_FILE_H #define CPP ...
- bootstrap模态框关闭后清除模态框的数据
https://segmentfault.com/q/1010000008789123 bootstrap模态框第二次打开时如何清除之前的数据? 我用了bootstrap模态框的remote功能,在弹 ...
- Flutter 中 JSON 解析
本文介绍一下Flutter中如何进行json数据的解析.在移动端开发中,请求服务端返回json数据并解析是一个很常见的使用场景.Android原生开发中,有GsonFormat这样的神器,一键生成Ja ...
- Artifact project04:war :Error during artifact deployment. See server log for details
困扰了我好长时间,我的错误是 先 Run clean 再package就成功了.
- python爬虫之scrapy文件下载
我们在写普通脚本的时候,从一个网站拿到一个文件的下载url,然后下载,直接将数据写入文件或者保存下来,但是这个需要我们自己一点一点的写出来,而且反复利用率并不高,为了不重复造轮子,scrapy提供很流 ...
- python之路--网络编程之socket
一 . 网络编程 CS架构 客户端服务端架构 服务端:提供服务的 客户端:享受服务的 BS架构:浏览器和服务端 网络通信流程: 集线器:将所有连接上它的电脑全部联通起来 交换机:升级版的集线器 网卡: ...
- 使用Guava cache构建本地缓存
前言 最近在一个项目中需要用到本地缓存,在网上调研后,发现谷歌的Guva提供的cache模块非常的不错.简单易上手的api:灵活强大的功能,再加上谷歌这块金字招牌,让我毫不犹豫的选择了它.仅以此博客记 ...
- Xamarin + MvvmCross 安装 Part 1
前言 最近,由于工作需要,公司准备开发移动端APP.临近年底,公司不准备大面招人,由于公司一直基于.net平台进行开发,本人自告奋勇,准备先用xamarin做下移动开发.开始了在网上不停的google ...