Cluster

A cluster's topology: which node owns which hash slots, how nodes find each other, failover and slot migration.

35 commands in KiviDB 1.1.2. Every command.

  • ASKING: Lets the connection's next command use a slot this node is importing (CLUSTER SETSLOT ... IMPORTING) but does not own yet.
  • CLUSTER: Manages a cluster node: which slots it owns, which nodes it knows, its replicas, and the moving of slots between masters.
    • 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.
  • MIGRATE: Moves keys to another server: each is serialised, restored on the server at host port in database db, with its time to live, and deleted here once the other server has acknowledged it.
  • READONLY: Lets the connection read from this replica: read commands for the slots of its master are served here, instead of being answered with MOVED.
  • READWRITE: Turns off READONLY for the connection: reads on a replica are redirected to the master again.