一、报错内容
(error) DENIED Redis is running in protected mode because protected mode is enabled and no password is set for the default user. In this mode connections are only accepted from the loopback 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 '--protected-mode no' option. 4) Setup a an authentication password for the default user. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
翻译结果
(错误)DENIED Redis正在保护模式下运行,因为启用了保护模式,并且没有为默认用户设置密码。在此模式下,只接受来自环回接口的连接。如果您想从外部计算机连接到Redis,您可以采用以下解决方案之一:1)只需通过从服务器运行的同一主机连接到Redis,从环回接口发送命令“CONFIG SET protected mode no”即可禁用受保护模式,但是,如果这样做,请确保不能从互联网公开访问Redis。使用配置重写将此更改永久化。2) 或者,您可以通过编辑Redis配置文件,将保护模式选项设置为“否”,然后重新启动服务器来禁用保护模式。3) 如果只是为了测试而手动启动服务器,请使用“-protected mode no”选项重新启动服务器。4) 为默认用户设置身份验证密码。注意:您只需要执行上述操作之一,服务器就可以开始接受来自外部的连接。
二、报错原因:
redis认为远程连接不安全,所以阻止你对redis进行操作
三、解决办法
3.1 修改配置
3.1.1 第一种方法是:关闭保护模式
[root@localhost redis-v7.0.5]# vi conf/redis.conf
# 修改保护模式为no,默认为 yes protected-mode no
3.1.2 方式二:添加密码访问
[root@localhost redis-v7.0.5]# vi conf/redis.conf # 手动添加以下内容 requirepass wangzy@123
3.2 重启服务
# 我这里用的是docker启动,故只要重启容器就好 docker restart 容器id
标签:保护模式,no,Redis,redis,protected,mode From: https://www.cnblogs.com/wangzy-Zj/p/17888206.html