mirror of
https://github.com/fluencelabs/redis
synced 2025-04-02 07:41:04 +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:
parent
d920177f8d
commit
297de1ab26
@ -3109,7 +3109,7 @@ int main(int argc, char **argv) {
|
|||||||
if (server.sofd > 0)
|
if (server.sofd > 0)
|
||||||
redisLog(REDIS_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
|
redisLog(REDIS_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
|
||||||
} else {
|
} else {
|
||||||
redisLog(REDIS_WARNING,"Sentinel runid is %s", server.runid);
|
sentinelIsRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Warning the user about suspicious maxmemory setting. */
|
/* Warning the user about suspicious maxmemory setting. */
|
||||||
|
@ -1223,6 +1223,7 @@ void initSentinelConfig(void);
|
|||||||
void initSentinel(void);
|
void initSentinel(void);
|
||||||
void sentinelTimer(void);
|
void sentinelTimer(void);
|
||||||
char *sentinelHandleConfiguration(char **argv, int argc);
|
char *sentinelHandleConfiguration(char **argv, int argc);
|
||||||
|
void sentinelIsRunning(void);
|
||||||
|
|
||||||
/* Scripting */
|
/* Scripting */
|
||||||
void scriptingInit(void);
|
void scriptingInit(void);
|
||||||
|
@ -413,6 +413,17 @@ void initSentinel(void) {
|
|||||||
sentinel.scripts_queue = listCreate();
|
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 ============================== */
|
/* ============================== sentinelAddr ============================== */
|
||||||
|
|
||||||
/* Create a sentinelAddr object and return it on success.
|
/* Create a sentinelAddr object and return it on success.
|
||||||
@ -2069,7 +2080,7 @@ int sentinelSendHello(sentinelRedisInstance *ri) {
|
|||||||
|
|
||||||
/* Try to obtain our own IP address. */
|
/* Try to obtain our own IP address. */
|
||||||
if (anetSockName(ri->cc->c.fd,ip,sizeof(ip),NULL) == -1) return REDIS_ERR;
|
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. */
|
/* Format and send the Hello message. */
|
||||||
snprintf(payload,sizeof(payload),
|
snprintf(payload,sizeof(payload),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user