mirror of
https://github.com/fluencelabs/redis
synced 2025-06-13 09:11:20 +00:00
Bind source address for cluster communication
The first address specified as a bind parameter (server.bindaddr[0]) gets used as the source IP for cluster communication. If no bind address is specified by the user, the behavior is unchanged. This patch allows multiple Redis Cluster instances to communicate when running on the same interface of the same host.
This commit is contained in:
@ -2411,9 +2411,14 @@ void clusterCron(void) {
|
||||
mstime_t old_ping_sent;
|
||||
clusterLink *link;
|
||||
|
||||
fd = anetTcpNonBlockConnect(server.neterr, node->ip,
|
||||
node->port+REDIS_CLUSTER_PORT_INCR);
|
||||
if (fd == -1) continue;
|
||||
fd = anetTcpNonBlockBindConnect(server.neterr, node->ip,
|
||||
node->port+REDIS_CLUSTER_PORT_INCR, server.bindaddr[0]);
|
||||
if (fd == -1) {
|
||||
redisLog(REDIS_DEBUG, "Unable to connect to "
|
||||
"Cluster Client [%s]:%d", node->ip,
|
||||
node->port+REDIS_CLUSTER_PORT_INCR);
|
||||
continue;
|
||||
}
|
||||
link = createClusterLink(node);
|
||||
link->fd = fd;
|
||||
node->link = link;
|
||||
|
Reference in New Issue
Block a user