(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改为你想要的重启服务器即可