DENIED Redis is running in protected mode 非本地客户端连接Redis报错问题

#java代码:

在这里插入图片描述

#报错如下:

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(由于启用了保护模式,没有指定绑定地址,也没有向客户机请求身份验证密码,所以拒绝Redis在受保护模式下运行。在这种模式下,连接只能从环回接口接受。如果你想从外部计算机连接到复述,你可能采取的解决方案:1)只是禁用保护模式发送命令的配置设置保护模式没有从loopback接口连接到复述同一主机服务器正在运行,然而确保复述,不是公开从互联网访问如果你这样做。使用CONFIG重写使此更改永久性。2)或者,您可以通过编辑Redis配置文件来禁用受保护模式,并将受保护模式选项设置为“no”,然后重新启动服务器。3)如果您只是为了测试而手动启动服务器,请使用“—protected-mode no”选项重新启动服务器。设置绑定地址或身份验证密码。注意:为了让服务器开始从外部接受连接,您只需要执行上述操作之一。)

#解决如下:

1、修改redis.windows.conf、redis.windows-service.conf文件
将bind 127.0.0.1 注释掉
2、打开redis-cli
输入config set protected-mode “no”
在这里插入图片描述

#注意:在配置redis一定要把redis的端口开放,不然你在java运行时会报个连接超时,解决如下

firewall-cmd --zone=public --add-port=xxxx/tcp --permanent
//重启防火墙
firewall-cmd --reload

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值