我正在使用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.能帮我解决这个问题吗?
发布于 2016-12-19 16:02:45
在redis 3.2中,Sentinel默认情况下是无法从本地主机以外的接口访问的。
要么使用' bind‘指令绑定到网络接口列表,要么使用“保护模式否”禁用保护模式,将其添加到此配置文件中。
例如,您可以使用以下内容之一:
bind 127.0.0.1 192.168.1.1
protected-mode no发布于 2017-11-13 11:29:24
为了进行测试,您可以尝试
redis-server --protected-mode no这将将Redis保护模式设置为否。
如文件所示,建议采取步骤。
1)只要从运行服务器的同一主机连接到Redis,就可以禁用保护模式,从环回接口发送命令“配置集保护模式no”,但是如果这样做,请确保Redis不能从internet公开访问。使用配置重写使此更改永久化。 2)或者,您可以通过编辑Redis配置文件并将保护模式选项设置为'no',然后重新启动服务器,从而禁用受保护模式。 3)如果只为测试而手动启动服务器,则使用“--保护模式--no”选项重新启动服务器。 4)设置绑定地址或身份验证密码。注意:您只需要做上述一件事,服务器就可以开始接受来自外部的连接。
https://stackoverflow.com/questions/41223618
复制相似问题