summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2012-08-29 11:44:01 +0200
committerantirez <antirez@gmail.com>2012-08-29 11:44:01 +0200
commit8246e58abebb7b4421a78d68e81bc8cd1ca536ac (patch)
tree14e5f904dcf8c88677e07582172893de60b8c30f
parent712656e8481f768470af82503dd84695496cd0a3 (diff)
downloadredis-8246e58abebb7b4421a78d68e81bc8cd1ca536ac.tar.gz
Sentinel: add Redis execution mode to INFO output.
The new "redis_mode" field in the INFO output will show if Redis is running in standalone mode, cluster, or sentinel mode.
-rw-r--r--src/redis.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/redis.c b/src/redis.c
index 0a22d45d0..a4ab9a964 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -1849,7 +1849,7 @@ sds genRedisInfoString(char *section) {
unsigned long lol, bib;
int allsections = 0, defsections = 0;
int sections = 0;
-
+
if (section) {
allsections = strcasecmp(section,"all") == 0;
defsections = strcasecmp(section,"default") == 0;
@@ -1862,7 +1862,12 @@ sds genRedisInfoString(char *section) {
/* Server */
if (allsections || defsections || !strcasecmp(section,"server")) {
struct utsname name;
+ char *mode;
+ if (server.cluster_enabled) mode = "cluster";
+ else if (server.sentinel_mode) mode = "sentinel";
+ else mode = "standalone";
+
if (sections++) info = sdscat(info,"\r\n");
uname(&name);
info = sdscatprintf(info,
@@ -1870,6 +1875,7 @@ sds genRedisInfoString(char *section) {
"redis_version:%s\r\n"
"redis_git_sha1:%s\r\n"
"redis_git_dirty:%d\r\n"
+ "redis_mode:%s\r\n"
"os:%s %s %s\r\n"
"arch_bits:%d\r\n"
"multiplexing_api:%s\r\n"
@@ -1883,6 +1889,7 @@ sds genRedisInfoString(char *section) {
REDIS_VERSION,
redisGitSHA1(),
strtol(redisGitDirty(),NULL,10) > 0,
+ mode,
name.sysname, name.release, name.machine,
server.arch_bits,
aeGetApiName(),