mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
fix to configuration saving on first start
This commit is contained in:
parent
c7c7cfbddc
commit
4b72c5617f
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user