(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
所以操作的时候导致报错。
- 解决过程:
- 首先我看到报错:
Redis is running in protected mode because protected mode is enabled
以为是我的protected-mode 是开着,看了一下是关的。

- 接着我把客户端运行命令由 redis-cli -h 192.168.23.129 -p 6381
改为了 redis-cli -p 6381
注意:如果没有-h 就是默认的是本机ip也就是127.0.0.1
结果发现能够执行命令不报错了。

- 原来我的服务器启动的是127.0.0.1这一个,
但是我的客户端连接的确实192.168.23.129这个
我打开我的redis-6381.conf配置文件,发现我把#bind 192.168.23.129给注释了

- 去掉注释,重启服务器就能够操作192.168.23.129这个服务器了
总结:
- 如果客户端启动 redis-cli -p 6381 没有-h就是默认本机ip 127.0.0.1
- 如何把bind 192.168.23.129注释掉 也是默认启动本地服务器
- 如果想连接其他服务器只需要把 bind 后面的ip改为你想要的重启服务器即可
本文解决了一个常见的Redis客户端连接错误问题,即由于服务器和客户端IP地址不匹配导致的连接失败。通过调整客户端连接命令和服务器配置文件,实现了正确的连接。
2355

被折叠的 条评论
为什么被折叠?



