文档 · 2018年12月6日 0

Redis解除保护模式

问题现象

-DENIED Redis is running in protected modebecause protected mode is enabled, no bind address was specified, noauthentication password is requested to clients. 
In this mode connections areonly accepted from the loopback interface. If you want to connect from externalcomputers to Redis you may adopt one of the following 
solutions: 1) Justdisable protected mode sending the command 'CONFIG SET protected-mode no' fromthe loopback interface by connecting to Redis from the same host 
the server isrunning, however MAKE SURE Redis is not publicly accessible from internet ifyou do so. Use CONFIG REWRITE to make this change permanent. 
2) Alternativelyyou can just disable the protected mode by editing the Redis configurationfile, and setting the protected mode option to 'no', and then restarting theserver. 
3) If you started the server manually just for testing, restart it withthe '--protected-mode no' option. 
4) Setup a bind address or an authenticationpassword. NOTE: You only need to do one of the above things in order for theserver to start accepting connections from the outside. 
Connection closed by foreign host.

1.修改Redis配置文件

vi redis.conf

2.修改配置文件绑定主机地址

bind yourIP
#例如我本机网卡IP为168.128.11.6 则改成 bind 168.128.11.6

3.修改配置文件redis守护进程

daemonize no

4.修改Redis配置文件保护模式

protected-mode no

5.保存修改重启redis服务,登录验证。大功告成。

打赏