Commit 4b72c561 authored by antirez's avatar antirez
Browse files

fix to configuration saving on first start

parent c7c7cfbd
......@@ -44,7 +44,7 @@ int clusterLoadConfig(char *filename) {
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);
}
......@@ -69,6 +69,8 @@ err:
}
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);
......@@ -79,17 +81,20 @@ void clusterInit(void) {
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment