Redis保护模式配置引起的问题

DENIED Redis is running in protected mode because protected mode is enabled, no bind address was ... 将文件位置切换为redis文件夹下的src中。进入redis数据库。 阅读详情

在新服务器上Jedis jedis = pool.getResource()

  • 报错:

redis.clients.jedis.exceptions.JedisDataException:
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.

在将redis集成在项目中时,如果是新安装在linux服务器的服务端,第一次使用往往会报JedisDataException:DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified异常。其实使用RedisTemplate连接远程Redis服务器的时候,Redis默认状态下是一守护状态下安装运行的,所以如果不是本地连接,就会报这个错误,而错误的提醒也很明显。redis的保护模式已经激活。没有绑定特定的连接ip地址,没有授权密码,
在这种情况下,连接只能是本地连接。
而想要从外部连接,则可以采取以下几种方式:

1):redis服务器运行时,在本地连接,并且运行命令:CONFIG SET protected-mode no.但是如果你要这样做,
你要确保Redis不要公开在互联网上,使用命令CONFIG REWRITE来使文件来永久的改变

2):第二种方式,你可以编辑Redis的配置文件,将protected mode选项的值改成no,并重新启动redis服务

3):如果你启动Redis只是为了测试使用,你可以重启Redis服务,加上–protected-mode no参数

4):设置绑定特定的ip地址或者给一个身份密码
以上的选项,使用其中一种就可以使用了,目前采用的是第四种方式的绑定本地的内网IP,只能将服务器的内网IP绑定到redis.conf下面,在阿里云上绑定了外网IP后无效。

配置文件:redis.conf

#bind 192.168.1.100 10.0.0.1
#bind 127.0.0.1 ::1

#protected-mode yes

#requirepass foobared
Caused by: redis.clients.jedis.exceptions.JedisDataException: 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.
redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

推荐的是使用第四种方式的给一个身份密码方式:

# vim ./redis.conf 

#Require clients to issue AUTH <PASSWORD> before processing any other 
#commands. This might be useful in environments in which you do not trust #others with access to the host running redis-server. 
#
#This should stay commented out for backward compatibility and because most 
#people do not need auth (e.g. they run their own servers). 
#
#Warning: since Redis is pretty fast an outside user can try up to 
#150k passwords per second against a good box. This means that you should #use a very strong password otherwise it will be very easy to break. 
# 
#requirepass foobared requirepass 123456789
$ auth 123456789
OK
$ set key:01 val123456
OK
$ get key:01
"val123456"
两节锂电池主动均衡设计实战:MP2642+PIC32MZ方案详解 锂电池串联应用中,单体电压不一致是导致容量衰减、寿命缩短和热失控风险的核心问题。其本质源于内阻差异、自放电率离散及温度响应非同步等物理特性,需通过主动均衡技术实现能量再分配而非简单泄放。相比被动均衡的低效与发热缺陷,基于双向DC-DC架构的主动均衡芯片(如MP2642GR-Z)可将高电压电池能量高效转移至低电压电池,实测均衡效率达89%,显著提升系统SOH与可用容量。该方案特别适用于对可靠性要求严苛的UPS、便携医疗电源及小型光储系统,强调硬件协同、温补校准与量产工艺鲁棒性。 阅读详情

相关推荐

ping不通6379端口,redis修改配置启动未生效

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

hans的博客 4672

Redis is running in protected mode

这是redis在安装后,如果非本机访问的话,会报的一个错误,这个错误还是比较长的: Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In ...

做你想做的人,没有时间的限制,只要愿意,什么时候都可以start。 3539

Qt OpenGL 3D 点云数据显示

在Qt中使用OpenGL显示3D点云数据是一个常见的需求,特别是在计算机视觉、机器人学和三维重建等领域。下面我将介绍一个基本的实现方案。

深之JohnChen的专栏 1238

Redis is running in protected mode because protected mode is enabled 问题处理

Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients 连接redis报错,根据错误信息,redis运行在受保护模式,需要修改redis配置

weixin_43989637的博客 2275

论文阅读—Square Attack: a query-efficient black-box adversarial attack via random search

论文阅读—Square Attack: a query-efficient black-box adversarial attack via random search 发表位置 ECCV 2020 摘要 作者提出了一种基于得分的黑盒Square attack,该模型不依赖于模型的局部梯度信息,因此可以绕过梯度隐藏防御攻击。Square Attack是一种随机搜索方法,它在随机位置选择局部的方形更新,使得每次迭代时扰动近似位于可行集的边界。 背景 当涉及到对安全至关重要的机器学习应用时,对抗性的例子尤其值得

yayayamaomaoya的博客 2493

VC Spyglass:Lint实战指南之TCL脚本自动化解析

本文详细介绍了如何利用TCL脚本实现VC Spyglass Lint检查的自动化流程。通过实战指南,从基础脚本编写到高级参数化技巧,帮助数字IC设计工程师摆脱手动操作,提升验证效率,并实现与CI/CD流程的集成。

h3i4j的博客 796

DENIED Redis is running in protected mode because protected mode is enabled, no bind address was spe

(error) DENIED Redis is running in protected mode because protected mode is enabled Redis protected-mode 是3.2 之后加入的新特性,在Redis.conf的注释中,我们可以了解到,他的具体作用和启用条件 链接redis 时只...

weixin_33800593的博客 1087

[明道云] -基础教学1- 创建第一个工作表:从 0 到实用

明道云工作表相当于数据库表,是存储业务数据的核心组件。创建工作表主要有两种方式:1)从空白新建,通过添加字段(最多200个)、设置属性、配置表单样式;2)从Excel导入,需选择sheet、配置字段映射。创建后系统自动生成默认视图,支持多种视图形式(看板/日历等)。建议设置合适的标题字段和关联关系,初学者可在一小时内完成基础应用搭建。后续可扩展权限控制、工作流自动化等功能。

每日出拳老爷子的博客 556

linux redis 关闭保护模式,允许外网访问配置。

当你在liunx下 安装好redis以后,如果需要外网访问,需要关闭保护模式否则连接失败: 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 th

u010797364的博客 2015

私家侦探如何追踪难以找到的人,掌握几个很少人知道的在线免费查询网站,搜索人名、电话号码以及地址的开源网站

私家侦探如何追踪难以找到的人,掌握几个很少人知道的在线免费查询网站,搜索人名、电话号码以及地址的开源网站。

代码讲故事 6487

基于Harness Engineering构建AI Agent的全自动化CI_CD流水线

AI Agent的CI/CD是指对Agent的全生命周期资产(代码、Prompt、RAG知识库、模型权重、工具配置)进行持续集成、持续测试、持续发布和持续观测的自动化流程,核心目标是在保障发布质量的前提下,最大化提升Agent的迭代效率。

AI云原生与云计算技术学院 625

redis 报错 Redis protected-mode 配置文件没有真正启动

(error) DENIED Redis is running in protected mode because protected mode is enabled Redis protected-mode 是3.2 之后加入的新特性,在Redis.conf的注释中,我们可以了解到,他的具体作用和启用条件 链接redis 时只能通过本地localhost (127.0.0.1)这个来链接,而不能用

Agly_Charlie的博客 7万+

DeepSeek R1-32B医疗大模型的完整微调实战分析(全码版)

【代码】DeepSeek R1-32B医疗大模型的完整微调实战指南(全码版)

AllenLV的博客 5102

学习随笔——虚拟机安装redis出现的小问题解决

一、前言 之前使用redis都是在本机安装,本机使用。这次在虚拟机安装redis并连接成功,踩了一些之前没踩过的坑,特此记录一下。 二、redis的保护模式 报错信息 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 connec

TIANQIcode 547

【AI智能体】Codex + Seedance2.5 制作AI视频实战操作详解

【AI智能体】Codex + Seedance2.5 制作AI视频实战操作详解

congge_study的博客 3800

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

redis保护模式的报错

1.首先得保证redis实在gcc环境下运行的 2.如果发现命令行中只能打印出大写在符号,那么长安【A】就好,或者shift+[A]试试 3.mini安装Linux发现连不了网,要在配置文件中启动网关,并且设置自动分配IP地址,如果手动配置IP地址的话开门,可能还是连不上 4.java连接Redis出现错误, --------(错误原因:1>Linux防火墙默认是开启的 2>Redis默认是保护模式(绑定到127.0.0.1)) 解决方法: 关闭防火墙同时关闭Redis的保护模式 按照java的

sudsahdua的博客 884

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

redis 关闭保护模式

1.错误代码没有贴,如果出现记得添加gcc包 image.png 2.如果发现命令行中只能打印出大写在符号,那么长安【A】就好,或者shift+[A]试试 3.mini安装Linux发现连不了网,要在配置文件中启动网关,并且设置自动分配IP地址,如果手动配置IP地址的话开门,可能还是连不上 4.java连接Redis出现错误, --------(错误原因:1>Linux防火墙默...

TonyWu的博客 1万+

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

redis关闭保护模式

2)Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程,设置为no。所以如果第一次使用没有设置管理员,就会出现报错,关闭保护模式即可。默认redis需要设置管理员账号密码,开启了保护模式。修改redis的守护进程为no ,不启用。修改redis的保护模式为no,不启用。redis开启了保护模式。3. 启动加载配置文件。

xiaoyunchang2的博客 419

redis之禁用保护模式以及修改监听IP

今天在安装filebeat的时候,出现了关于redis报错的问题,所以来总结一下: 报错信息是: (error) DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication passwor...

weixin_34344403的博客 704

关于 Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolEx

错误原因是因为开启了保护模式,在配置文件redis.conf中找到daemonize=yes,改为daemonize=no即可。进入这个目录下的文件:vi /etc/systemd/system/redis.service。删掉后别忘了systemctl daemon-reload一下再开启redis。在这时候我输入systemctl start redis又出现一个问题。删除Type=forking即可解决问题。

weixin_61997710的博客 1433

踩坑日记:项目中Redis报错错误“500”:Redis is running in protected mode because protected mode is enabled

昨天晚上项目的job突然报警,执行失败,然后检查了项目中的数据是没有问题的,查看了日志,报下面的错误,然后所有的接口都报Redis错误“500”。 DENIED Redis is runninginprotected mode because protected mode is enabled, no bind address was specified, <br>no authentication password is requested to clients. In this mod..

好学而不勤问非真好学者 2857

Linux安装redis,redis无法连接问题总结

虚拟机(centos7)安装redis 请移步:https://blog.youkuaiyun.com/ITxiaofeixiang/article/details/111390055 问题描述 Resolved [redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool] springboot项目集成redis测试,出现连接超时问题等。 前提 host和port设置都没问题。 虚拟机

ITxiaofeixiang的博客 1869

python redis密码登录_Python远程连接Redis

import redisr=redis.Redis(host=‘192.168.56.102‘,port=6379,db=0,password=‘jinxfredis‘ )r.set(‘name‘,‘jin‘)print(r.get(‘name‘))Python远程连接Redis时报如下错误:DENIED Redis is running in protected mode because pro...

weixin_34379088的博客 3809

redis 报错 Redis protected-mode 配置文件没有真正启动

文章来源: https://blog.youkuaiyun.com/Agly_Clarlie/article/details/52251746 https://blog.youkuaiyun.com/Agly_Clarlie/article/details/52251746 https://blog.youkuaiyun.com/fly43108622/article/details/52972433 问题表象: (...

z69183787的专栏 1684
上一篇: ArrayList源码解析
下一篇: SpringContextHolder使用报错及@Lazy使用
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值