解决使用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 ...
随机推荐
- Linux 光盘挂载步骤
mount -t fs_type device dir 挂载操作 常见的文件系统类型 Windows :ntfs.fat32 Linux:ext3.ext4.xfs 光盘: iso9660 挂载光盘: ...
- 移动端和PC端页面常用的弹出层
我们在页面的时候,很多时候用到了弹出层,消息提醒,确认框等等,统一样式的弹出框可以使页面更加优美.在此,我整理一下我们项目的移动端和PC端页面常用的弹出层. 一.移动端 我们需在页面引入弹出框的样式和 ...
- AJAX返回值问题
ajax同步方式获取返回值,必须以同步请求的的方式获取. //主函数部分 function confirm(id,...)//省略部分参数 { //...省略部分代码 //任务涉及专业 var Maj ...
- [转帖]xserver相关知识汇总
xserver相关知识汇总 https://blog.csdn.net/QTVLC/article/details/81739984 本文主要是从以下几个方面介绍xorg-xserver 相关的知 ...
- php-memcached详解
一.memcached 简介 在很多场合,我们都会听到 memcached 这个名字,但很多同学只是听过,并没有用过或实际了解过,只知道它是一个很不错的东东.这里简单介绍一下,memcached 是高 ...
- Decoder is not a @Sharable handler, so can't be added or removed multiple times
Decoder is not a @Sharable handler, so can't be added or removed multiple times final MyMessageDecod ...
- Spring 的java 配置方式
Java配置是Spring4.x推荐的配置方式,可以完全替代xml配置. 1.1@Configuration 和 @Bean Spring的Java配置方式是通过 @Configuration 和 @ ...
- 错误模块名称: KERNELBASE.dll错误
今天在部署一个C/S程序的时候出了bug,日志都没有记载:本地调试当然是没问题的,所以不是代码问题,百度之发现KERNELBASE.dll这个文章说的比较靠谱,仔细研究了自己的配置文件后,果然是配置文 ...
- Lodop如何打印直线
Lodop打印设计提供了可视化设计,生成代码的方便,在打印设计界面上,选择添加打印项的时候,可以看到没有添加直线选项,可添加斜线,然后把添加的斜线调整成直线:线宽=高 -----水平直线线宽=宽--- ...
- CodeForces - 1051D Bicolorings(DP)
题目链接:http://codeforces.com/problemset/problem/1051/D 看了大佬的题解后觉着是简单的dp,咋自己做就做不来呢. 大佬的题解:https://www.c ...