return REDIS_OK;
fmterr:
- redisLog(REDIS_WARNING,"Unrecovarable error: corrupted cluster.conf file.");
+ redisLog(REDIS_WARNING,"Unrecovarable error: corrupted redis-cluster.conf file.");
fclose(fp);
exit(1);
}
}
void clusterInit(void) {
+ int saveconf = 0;
+
server.cluster.myself = createClusterNode(NULL,REDIS_NODE_MYSELF);
server.cluster.state = REDIS_CLUSTER_FAIL;
server.cluster.nodes = dictCreate(&clusterNodesDictType,NULL);
sizeof(server.cluster.importing_slots_from));
memset(server.cluster.slots,0,
sizeof(server.cluster.slots));
- if (clusterLoadConfig("cluster.conf") == REDIS_ERR) {
+ if (clusterLoadConfig("redis-cluster.conf") == REDIS_ERR) {
/* No configuration found. We will just use the random name provided
* by the createClusterNode() function. */
redisLog(REDIS_NOTICE,"No cluster configuration found, I'm %.40s",
server.cluster.myself->name);
- if (clusterSaveConfig("cluster.conf") == -1) {
+ saveconf = 1;
+ }
+ clusterAddNode(server.cluster.myself);
+ if (saveconf) {
+ if (clusterSaveConfig("redis-cluster.conf") == -1) {
redisLog(REDIS_WARNING,"Fatal: can't update cluster config file.");
exit(1);
}
}
- clusterAddNode(server.cluster.myself);
/* We need a listening TCP port for our cluster messaging needs */
server.cfd = anetTcpServer(server.neterr,
server.port+REDIS_CLUSTER_PORT_INCR, server.bindaddr);