我正在使用Redis 3.2,当从不同的机器连接到哨兵时,我收到以下错误:
Trying X.X.X.X...
Connected to X.X.X.X.
Escape character is '^]'.
-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.
Connection closed by foreign host.
Run Code Online (Sandbox Code Playgroud)
somene可以帮我解决这个问题吗?
Kar*_*nna 13
从redis 3.2开始,默认情况下为Sentinel,无法从localhost以外的接口访问.
使用'bind'指令绑定到网络接口列表,或者通过将保护模式添加到此配置文件来禁用"protected-mode no"保护模式.
例如,您可以使用以下之一:
bind 127.0.0.1 192.168.1.1
protected-mode no
Run Code Online (Sandbox Code Playgroud)
为了进行测试,您可以尝试
redis-server --protected-mode no
Run Code Online (Sandbox Code Playgroud)
这会将Redis保护模式设置为no。
从文档建议的步骤开始。
1)只需通过从运行服务器的同一主机连接到Redis,从环回接口发送“ CONFIG SET protected-mode no”命令来禁用保护模式,但是,如果这样做,则不能从Internet公开访问Redis。使用CONFIG REWRITE使更改永久生效。
2)或者,您可以通过编辑Redis配置文件,然后将保护模式选项设置为“ no”,然后重新启动服务器来禁用保护模式。
3)如果仅出于测试目的手动启动服务器,请使用“ --protected-mode no”选项重新启动服务器。
4)设置绑定地址或身份验证密码。注意:您只需执行上述操作之一,服务器就可以开始接受来自外部的连接。
| 归档时间: |
|
| 查看次数: |
10932 次 |
| 最近记录: |