CLUSTER
Since 1.1.0Cluster
Syntax
CLUSTERManages a cluster node: which slots it owns, which nodes it knows, its replicas, and the moving of slots between masters. A cluster node is started with cluster-enabled yes. On a standalone server the subcommands answer as for a node with no cluster: CLUSTER INFO gives cluster_enabled:0, and CLUSTER SLOTS an empty array.
The keyspace is split into 16384 slots; CLUSTER KEYSLOT gives a key's. A command for a slot this node does not own is answered with MOVED slot host:port, the node that owns it, and a cluster client follows that. A cluster node has one database: SELECT of any but 0 is refused.
Subcommands
- CLUSTER ADDSLOTS: Makes this node the owner of each slot.
- CLUSTER ADDSLOTSRANGE: Like CLUSTER ADDSLOTS, for the ranges start to end, both included.
- CLUSTER BUMPEPOCH: Increments the cluster's current epoch and gives it to this node, so that this node's claims to its slots win over older ones.
- CLUSTER COUNT-FAILURE-REPORTS: Returns how many other nodes currently report node-id as failing.
- CLUSTER COUNTKEYSINSLOT: Returns the number of keys this node holds in slot.
- CLUSTER DELSLOTS: Makes this node give up each slot.
- CLUSTER DELSLOTSRANGE: Like CLUSTER DELSLOTS, for the ranges start to end, both included.
- CLUSTER FAILOVER: Sent to a replica: makes it the master of its shard, and its master a replica of it.
- CLUSTER FLUSHSLOTS: Makes this node give up every slot it owns, as CLUSTER DELSLOTS of each.
- CLUSTER FORGET: Removes the node node-id from this node's table.
- CLUSTER GETKEYSINSLOT: Returns up to count of the keys this node holds in slot.
- CLUSTER HELP: Lists the CLUSTER subcommands and what each does.
- CLUSTER INFO: Returns the node's view of the cluster as field:value lines: whether the cluster is up (cluster_state), how many slots are assigned and how many of those are failing, the nodes it knows, the number o…
- CLUSTER KEYSLOT: Returns the slot of key: the CRC16 of the key, modulo 16384.
- CLUSTER LINKS: Returns this node's links to other nodes on the cluster bus: for each, direction, node, create-time, events, send-buffer-allocated and send-buffer-used.
- CLUSTER MEET: Introduces the node at ip port to this one, which then tells the rest of the cluster about it.
- CLUSTER MIGRATION: Moves whole slot ranges to this node from the master that owns them, in the background: Redis 8.4's atomic slot migration.
- CLUSTER MYID: Returns this node's ID: 40 hexadecimal characters, kept in nodes.conf across restarts.
- CLUSTER MYSHARDID: Returns the ID of this node's shard: a master's own ID, or a replica's master's.
- CLUSTER NODES: Returns the node table, one line per node, in the format of Redis's CLUSTER NODES: ID, ip:port@bus-port, flags (myself, master, slave, fail?, fail, …), the master's ID for a replica or -, the times t…
- CLUSTER REPLICAS: Returns the replicas of the master master-id, each as a CLUSTER NODES line.
- CLUSTER REPLICATE: Makes this node a replica of the master master-id.
- CLUSTER RESET: Clears this node's topology: it forgets the other nodes and which slots it owns, and becomes a master with no slots.
- CLUSTER SAVECONFIG: Writes the node's topology to nodes.conf (cluster-config-file) now.
- CLUSTER SET-CONFIG-EPOCH: Sets this node's config epoch, for giving each node of a new cluster a different one before it serves.
- CLUSTER SETSLOT: Sets the state of one slot on this node, for moving it by hand.
- CLUSTER SHARDS: Returns each shard: its slot ranges, and its nodes, each with id, port, ip, endpoint, role (master or replica), replication-offset and health.
- CLUSTER SLAVES: Another name for CLUSTER REPLICAS, which Redis deprecates.
- CLUSTER SLOT-STATS: Returns statistics for each slot this node owns: for slots start to end, or for the n first by metric (LIMIT defaults to 16384).
- CLUSTER SLOTS: Returns which node serves each range of slots: for each range, its first and last slot, then the master as [ip, port, id], then each of its replicas the same way.