Redis bind 多个IP出错
黄舟
黄舟 2017-04-24 09:09:50
0
3
994

我的目的就是让A,B两台服务器能够访问部署在A上的Redis。
文档里说,Redis 2.8以上的版本支持在配置文件里bind多个IP,例如:

bind 192.168.1.100 10.0.0.1

我是2.8以上的版本,然后按照这样的方式,进行了如下设置:

bind IP-A IP-B

可是发现结果A和B都不能访问了。请问这是什么原因呢?我配置错了吗?

另外我知道注释掉原来的bind 127.0.0.1可以放开访问权限,然后再用防火墙进行限制。但我想弄清楚上面的问题。如有回复,非常感谢!

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
大家讲道理

Hello, this problem is caused by a misunderstanding caused by many documents explaining bind. Many places are translated as follows:

Specify redis to only receive requests from this IP address. If not set, all requests will be processed. It is best to set this item in a production environment

However, in fact, what should be bound is the IP of the network card of the server where redis is located. In other words, if your redis server has two network cards, one is ip-1 and the other is ip-2, if you bind ip-1. Then only the request for ip-1 will be accepted.

You can refer to this article: bind in redis and external network access

Peter_Zhu

For the correct answer upstairs, see what is stated in redis.conf.

# By default Redis listens for connections from all the **network interfaces**
# available on the server. It is possible to listen to just one or multiple
# interfaces using the "bind" configuration directive, followed by one or
# more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1
左手右手慢动作

Is it possible to bind the internal network and external network IP at the same time

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template