(error) DENIED Redis is running in protected mode because protected mode is enabled 解决办法 – 21运维
通知: .-...

(error) DENIED Redis is running in protected mode because protected mode is enabled 解决办法

Nosql 21运维 3137浏览 0评论

本文主要记录一个redis启用公网IP连接报错。
(error) DENIED Redis is running in protected mode because protected mode is enable
Redis protected-mode 是3.2 之后加入的新特性,在Redis.conf的注释中,我们可以了解到,他的具体作用和启用条件

链接redis 时只能通过本地localhost (127.0.0.1)这个来链接,而不能用网络ip(192.168..内网或者网卡的公网IP)链接,需要我们bind设置bind绑定IP地址或者是将bind直接注释。

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 lookback 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 --portected-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.conf
1)修改redis.conf配置文件。

# bind 127.0.0.1

 

2)保护模式调整
注释bind以后启动会报错,就是上边的代码。解决办法如下:
设置

protected-mode no

或者直接redis-cli以后执行:

CONFIG SET protected-mode no

3)再去启动就可以了。

转载请注明:21运维 » (error) DENIED Redis is running in protected mode because protected mode is enabled 解决办法

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (2)

  1. 弄了好久,都是让改redis.conf中的protected-mode no。可是都不起作用,最后使用第二种redis-cli以后执行CONFIG SET protected-mode no后可以访问。。。感谢
    Balance2019-10-14 14:26 回复
  2. 看的头都大了
    卢松松商城2016-11-04 11:32 回复