解决使用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 ...
随机推荐
- 面试题(校招java)
1:linux线程和进程的区别? 进程是程序执行时的一个实例,即它是程序已经执行到课中程度的数据结构的汇集.从内核的观点看,进程的目的就是担当分配系统资源(CPU时间.内存等)的基本单位. 线程是进程 ...
- [转帖]学习关于TTL
自己简单试了一下在家里与在公司里面服务器的连接: C:\Users\Administrator>tracert oms.inspur.com 通过最多 个跃点跟踪 到 oms.inspur.co ...
- Laravel从入门到精通
1. Laravel框架的下载安装 例如: 在D:\test\laravel目录下新建一个目录为test_laravel 第一步,下载laravel框架 在D:\test\laravel\test_l ...
- 取得数据表中前N条记录,某列重复的话只取第一条记录
项目需要筛选出不重复数据,以前没有做过,第一反应就是利用distinct处理,但是弄了好久也没搞出来,大家有知道的望告知下. 这次筛选没有使用distinct ,是利用group by ,利用id为唯 ...
- List接口方法
package cn.zhou.com; /* * List?-------是啥? Collection 的一个子接口! * * 集合?容器? * * 区分容器,每个容器的数据结构不一样! * 集合, ...
- Oracle minus用法详解及应用实例
本文转载:https://blog.csdn.net/jhon_03/article/details/78321937 Oracle minus用法 “minus”直接翻译为中文是“减”的意思,在Or ...
- epoch、 iteration和batchsize区别
转自: https://blog.csdn.net/qq_27923041/article/details/74927398 深度学习中经常看到epoch. iteration和batchsize,下 ...
- 如何安装或卸载Lodop、C-Lodop
安装:下载.exe安装文件,一步步安装就行,如不特意拦截,应该是100%可以安装成功.客户端本地打印角色等,直接一步步安装就行,如果是广域网AO打印那种,在服务器上安装的c-lodop,需要勾选服务器 ...
- windows git支持arc命令
本文整理了在Windows系统上安装代码审查工具Arcanist的过程.目的是配合Phabricator进行代码review.配置成功后可使用arc diff命令来发起code review. 1.安 ...
- 当进行数据查询时候 要考虑创建一个model ;具备传入与输出的字段
当进行数据查询时候 要考虑创建一个model ;具备传入与输出的字段