MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / sentinelCommand

Function sentinelCommand

src/sentinel.cpp:3536–3905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3534}
3535
3536void sentinelCommand(client *c) {
3537 if (c->argc == 2 && !strcasecmp(szFromObj(c->argv[1]),"help")) {
3538 const char *help[] = {
3539"CKQUORUM <master-name>",
3540" Check if the current Sentinel configuration is able to reach the quorum",
3541" needed to failover a master and the majority needed to authorize the",
3542" failover.",
3543"CONFIG SET <param> <value>",
3544" Set a global Sentinel configuration parameter.",
3545"CONFIG GET <param>",
3546" Get global Sentinel configuration parameter.",
3547"GET-MASTER-ADDR-BY-NAME <master-name>",
3548" Return the ip and port number of the master with that name.",
3549"FAILOVER <master-name>",
3550" Manually failover a master node without asking for agreement from other",
3551" Sentinels",
3552"FLUSHCONFIG",
3553" Force Sentinel to rewrite its configuration on disk, including the current",
3554" Sentinel state.",
3555"INFO-CACHE <master-name>",
3556" Return last cached INFO output from masters and all its replicas.",
3557"IS-MASTER-DOWN-BY-ADDR <ip> <port> <current-epoch> <runid>",
3558" Check if the master specified by ip:port is down from current Sentinel's",
3559" point of view.",
3560"MASTER <master-name>",
3561" Show the state and info of the specified master.",
3562"MASTERS",
3563" Show a list of monitored masters and their state.",
3564"MONITOR <name> <ip> <port> <quorum>",
3565" Start monitoring a new master with the specified name, ip, port and quorum.",
3566"MYID",
3567" Return the ID of the Sentinel instance.",
3568"PENDING-SCRIPTS",
3569" Get pending scripts information.",
3570"REMOVE <master-name>",
3571" Remove master from Sentinel's monitor list.",
3572"REPLICAS <master-name>",
3573" Show a list of replicas for this master and their state.",
3574"RESET <pattern>",
3575" Reset masters for specific master name matching this pattern.",
3576"SENTINELS <master-name>",
3577" Show a list of Sentinel instances for this master and their state.",
3578"SET <master-name> <option> <value>",
3579" Set configuration paramters for certain masters.",
3580"SIMULATE-FAILURE (CRASH-AFTER-ELECTION|CRASH-AFTER-PROMOTION|HELP)",
3581" Simulate a Sentinel crash.",
3582NULL
3583 };
3584 addReplyHelp(c, help);
3585 } else if (!strcasecmp(szFromObj(c->argv[1]),"masters")) {
3586 /* SENTINEL MASTERS */
3587 if (c->argc != 2) goto numargserr;
3588 addReplyDictOfRedisInstances(c,sentinel.masters);
3589 } else if (!strcasecmp(szFromObj(c->argv[1]),"master")) {
3590 /* SENTINEL MASTER <name> */
3591 sentinelRedisInstance *ri;
3592
3593 if (c->argc != 3) goto numargserr;

Callers

nothing calls this directly

Calls 15

szFromObjFunction · 0.85
addReplyHelpFunction · 0.85
addReplyBulkCBufferFunction · 0.85
getLongFromObjectOrReplyFunction · 0.85
sentinelVoteLeaderFunction · 0.85
addReplyArrayLenFunction · 0.85
addReplyFunction · 0.85

Tested by

no test coverage detected