Cluster: SLAVEOF command not allowed in cluster mode.

This commit is contained in:
antirez 2013-03-05 12:39:11 +01:00
parent e4b481a5f6
commit b7d085fc0d

View File

@ -1251,6 +1251,15 @@ void replicationUnsetMaster(void) {
} }
void slaveofCommand(redisClient *c) { void slaveofCommand(redisClient *c) {
/* SLAVEOF is not allowed in cluster mode as replication is automatically
* configured using the current address of the master node. */
if (server.cluster_enabled) {
addReplyError(c,"SLAVEOF not allowed in cluster mode.");
return;
}
/* The special host/port combination "NO" "ONE" turns the instance
* into a master. Otherwise the new master address is set. */
if (!strcasecmp(c->argv[1]->ptr,"no") && if (!strcasecmp(c->argv[1]->ptr,"no") &&
!strcasecmp(c->argv[2]->ptr,"one")) { !strcasecmp(c->argv[2]->ptr,"one")) {
if (server.masterhost) { if (server.masterhost) {