西数超哥博客
运维经验教程分享

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

本文主要记录一个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)再去启动就可以了。

转载请注明:西数超哥博客www.ysidc.top» (error) DENIED Redis is running in protected mode because protected mode is enabled 解决办法

https://www.ysidc.top 西数超哥博客,数据库,西数超哥,虚拟主机,域名注册,域名,云服务器,云主机,云建站,ysidc.top

赞(0)
声明:本站发布的内容(图片、视频和文字)以原创、转载和分享网络内容为主,若涉及侵权请及时告知,将会在第一时间删除。本站原创内容未经允许不得转载:西数超哥博客 » (error) DENIED Redis is running in protected mode because protected mode is enabled 解决办法