mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 00:31:21 +00:00
Sentinel: test for writable config file.
This commit introduces a funciton called when Sentinel is ready for normal operations to avoid putting Sentinel specific stuff in redis.c.
This commit is contained in:
@ -415,6 +415,17 @@ void initSentinel(void) {
|
||||
sentinel.scripts_queue = listCreate();
|
||||
}
|
||||
|
||||
/* This function gets called when the server is in Sentinel mode, started,
|
||||
* loaded the configuration, and is ready for normal operations. */
|
||||
void sentinelIsRunning(void) {
|
||||
redisLog(REDIS_WARNING,"Sentinel runid is %s", server.runid);
|
||||
|
||||
if (server.configfile == NULL || access(server.configfile,W_OK) == -1) {
|
||||
redisLog(REDIS_WARNING,"Sentinel started without a config file, or config file not writable. Exiting...");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================== sentinelAddr ============================== */
|
||||
|
||||
/* Create a sentinelAddr object and return it on success.
|
||||
@ -2071,7 +2082,7 @@ int sentinelSendHello(sentinelRedisInstance *ri) {
|
||||
|
||||
/* Try to obtain our own IP address. */
|
||||
if (anetSockName(ri->cc->c.fd,ip,sizeof(ip),NULL) == -1) return REDIS_ERR;
|
||||
if (ri->flags & SRI_DISCONNECTED) return;
|
||||
if (ri->flags & SRI_DISCONNECTED) return REDIS_ERR;
|
||||
|
||||
/* Format and send the Hello message. */
|
||||
snprintf(payload,sizeof(payload),
|
||||
|
Reference in New Issue
Block a user