From b8a28bf4422b95d99527b6c73023621d1d350758 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 4 Mar 2013 15:27:58 +0100 Subject: [PATCH] Cluster: actually setup replication in CLUSTER REPLICATE. --- src/cluster.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cluster.c b/src/cluster.c index 25c5950c..a89ef9d7 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1513,7 +1513,7 @@ void clusterSetMaster(clusterNode *n) { myself->flags |= REDIS_NODE_SLAVE; } myself->slaveof = n; - /* TODO: actually handle replication to point to the new slave. */ + replicationSetMaster(n->ip, n->port); } /* ----------------------------------------------------------------------------- @@ -1900,6 +1900,8 @@ void clusterCommand(redisClient *c) { /* Set the master. */ clusterSetMaster(n); + clusterUpdateState(); + clusterSaveConfigOrDie(); addReply(c,shared.ok); } else { addReplyError(c,"Wrong CLUSTER subcommand or number of arguments");