Redis Cluster: reconfigure replication when master changes address.

This commit is contained in:
antirez 2013-12-20 12:47:13 +01:00
parent d7374032c0
commit fda4cba912

View File

@ -986,6 +986,14 @@ int nodeUpdateAddressIfNeeded(clusterNode *node, clusterLink *link, int port) {
if (node->link) freeClusterLink(node->link);
redisLog(REDIS_WARNING,"Address updated for node %.40s, now %s:%d",
node->name, node->ip, node->port);
/* Check if this is our master and we have to change the
* replication target as well. */
if (server.cluster->myself->flags & REDIS_NODE_SLAVE &&
server.cluster->myself->slaveof == node)
{
replicationSetMaster(node->ip, node->port);
}
return 1;
}