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. 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 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.
时间: 2023-05-31 07:17:54 浏览: 255
### 回答1:
Redis运行在保护模式下,因为启用了保护模式,没有指定绑定地址,也没有要求客户端进行身份验证。在此模式下,只有从回环接口接受连接。如果您想从外部计算机连接到Redis,可以采用以下解决方案之一:1)只需从回环接口发送命令“config set protected-mode no”禁用保护模式,通过从运行服务器的同一主机连接到Redis,但是请确保Redis不可从Internet公开访问。使用config rewrite使此更改永久生效。2)或者,您可以通过编辑Redis配置文件并将保护模式选项设置为“no”,然后重新启动服务器来禁用保护模式。3)如果您仅为测试手动启动了服务器,请使用“--protected-mode no”选项重新启动它。4)设置绑定地址或身份验证密码。注意:您只需要执行上述其中一项操作,即可使服务器开始接受来自外部的连接。
### 回答2:
Redis是一个非常流行的开源内存数据库,但在一些情况下,运行Redis时会看到“redis正在保护模式下运行”这个提示,这是为了保护Redis不受到未经授权的访问。保护模式允许Redis只从回环接口接受连接,不允许从外部计算机连接。
造成这种情况的原因可能是因为Redis运行在保护模式下,没有指定绑定地址或没有设置认证密码,因此,如果想要从外部计算机连接到Redis,可以采取以下几种解决方案:
1.在回环接口连接Redis,发送“config set protected-mode no”的命令来禁用保护模式,但是请确保Redis不可通过互联网公开访问,可以使用“config rewrite”使更改永久生效。
2.通过编辑Redis配置文件并将保护模式设置为“no”,然后重新启动服务器来禁用保护模式。
3.如果手动启动服务进行测试,则可以使用“--protected-mode no”的选项来重新启动服务器。
4.设置一个绑定地址或认证密码。
需要注意的是,禁用Redis的保护模式需要小心,要确保只有经过授权的用户才能访问。此外,为了保护Redis的安全,应在必要时使用防火墙或其他安全措施来限制访问。
### 回答3:
Redis运行在保护模式下,因为启用了保护模式,没有指定绑定地址,没有请求客户端进行身份验证。在这种模式下,只有来自回环接口的连接才被接受。如果你想从外部计算机连接到Redis,可以采用以下解决方案之一:
1)从回环接口连接到Redis,通过发送命令“config set protected-mode no”来禁用保护模式,但是请确保如果您这样做,Redis不可从公网访问。使用“config rewrite”命令使此更改永久化。
2)或者,只需编辑Redis配置文件,将保护模式选项设置为“no”,然后重新启动服务器即可禁用保护模式。
3)如果您手动启动了服务器以进行测试,请使用“-—protected-mode no”选项重新启动。
4)设置绑定地址或身份验证密码。
说明:这条信息的意思是Redis运行在保护模式下,因为没有指定绑定地址或身份验证密码,只能接受来自回环接口的连接。为了能够从外部计算机连接到Redis,需要执行上述解决方案中的一个。如果您仅在测试目的下手动启动了服务器,请使用第三种解决方案重新启动服务器。
阅读全文