Redis客户端操作指令 报错(error) DENIED Redis is running in protected mode because protected mode is enabled

  • 问题:Redis数据库客户端操作报错

(error) 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.(error) 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.在这里插入图片描述

  • 原因:

对于这种类型的报错一般都是客户端连接的服务器和启动的redis服务器不是同一个
例如:你的服务器连接的是本机host的127.0.0.1
而你的客户端启动的却是192.168.23.129
所以操作的时候导致报错。

  • 解决过程:
  1. 首先我看到报错:
    Redis is running in protected mode because protected mode is enabled
    以为是我的protected-mode 是开着,看了一下是关的。
    在这里插入图片描述
  2. 接着我把客户端运行命令由 redis-cli -h 192.168.23.129 -p 6381
    改为了 redis-cli -p 6381
    注意:如果没有-h 就是默认的是本机ip也就是127.0.0.1
    结果发现能够执行命令不报错了。
    在这里插入图片描述
  3. 原来我的服务器启动的是127.0.0.1这一个,
    但是我的客户端连接的确实192.168.23.129这个
    我打开我的redis-6381.conf配置文件,发现我把#bind 192.168.23.129给注释了
    在这里插入图片描述
  4. 去掉注释,重启服务器就能够操作192.168.23.129这个服务器了

总结:

  1. 如果客户端启动 redis-cli -p 6381 没有-h就是默认本机ip 127.0.0.1
  2. 如何把bind 192.168.23.129注释掉 也是默认启动本地服务器
  3. 如果想连接其他服务器只需要把 bind 后面的ip改为你想要的重启服务器即可
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值