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

Function clusterCommand

src/cluster.cpp:4482–5116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4480}
4481
4482void clusterCommand(client *c) {
4483 if (g_pserver->cluster_enabled == 0) {
4484 addReplyError(c,"This instance has cluster support disabled");
4485 return;
4486 }
4487
4488 if (c->argc == 2 && !strcasecmp(szFromObj(c->argv[1]),"help")) {
4489 const char *help[] = {
4490"ADDSLOTS <slot> [<slot> ...]",
4491" Assign slots to current node.",
4492"BUMPEPOCH",
4493" Advance the cluster config epoch.",
4494"COUNT-FAILURE-REPORTS <node-id>",
4495" Return number of failure reports for <node-id>.",
4496"COUNTKEYSINSLOT <slot>",
4497" Return the number of keys in <slot>.",
4498"DELSLOTS <slot> [<slot> ...]",
4499" Delete slots information from current node.",
4500"FAILOVER [FORCE|TAKEOVER]",
4501" Promote current replica node to being a master.",
4502"FORGET <node-id>",
4503" Remove a node from the cluster.",
4504"GETKEYSINSLOT <slot> <count>",
4505" Return key names stored by current node in a slot.",
4506"FLUSHSLOTS",
4507" Delete current node own slots information.",
4508"INFO",
4509" Return information about the cluster.",
4510"KEYSLOT <key>",
4511" Return the hash slot for <key>.",
4512"MEET <ip> <port> [<bus-port>]",
4513" Connect nodes into a working cluster.",
4514"MYID",
4515" Return the node id.",
4516"NODES",
4517" Return cluster configuration seen by node. Output format:",
4518" <id> <ip:port> <flags> <master> <pings> <pongs> <epoch> <link> <slot> ...",
4519"REPLICATE (<node-id>|NO ONE)",
4520" Configure current node as replica to <node-id> or turn it into empty primary.",
4521"RESET [HARD|SOFT]",
4522" Reset current node (default: soft).",
4523"SET-CONFIG-EPOCH <epoch>",
4524" Set config epoch of current node.",
4525"SETSLOT <slot> (IMPORTING|MIGRATING|STABLE|NODE <node-id>)",
4526" Set slot state.",
4527"REPLICAS <node-id>",
4528" Return <node-id> replicas.",
4529"SAVECONFIG",
4530" Force saving cluster configuration on disk.",
4531"SLOTS",
4532" Return information about slots range mappings. Each range is made of:",
4533" start, end, master and replicas IP addresses, ports and ids",
4534NULL
4535 };
4536 addReplyHelp(c, help);
4537 } else if (!strcasecmp(szFromObj(c->argv[1]),"meet") && (c->argc == 4 || c->argc == 5)) {
4538 /* CLUSTER MEET <ip> <port> [cport] */
4539 long long port, cport;

Callers

nothing calls this directly

Calls 15

addReplyErrorFunction · 0.85
szFromObjFunction · 0.85
addReplyHelpFunction · 0.85
getLongLongFromObjectFunction · 0.85
addReplyErrorFormatFunction · 0.85
ptrFromObjFunction · 0.85
clusterStartHandshakeFunction · 0.85
addReplyFunction · 0.85
connGetTypeFunction · 0.85
addReplyVerbatimFunction · 0.85
sdslenFunction · 0.85

Tested by

no test coverage detected