DBAtlas · Database operations atlas

Check cluster health and repair slot inconsistencies (--cluster check/fix)

RedisCluster

Command

redis-cli -h node1 -p 6379 CLUSTER INFO
redis-cli -h node1 -p 6379 CLUSTER NODES
redis-cli -h node1 -p 6379 CLUSTER SHARDS
# Slot coverage, open (migrating/importing) slots and node consistency:
redis-cli --cluster check node1:6379
# Repair if there are open or unowned slots:
redis-cli --cluster fix node1:6379
# Which slot and node a key lives on (-c: follow redirects):
redis-cli -h node1 -p 6379 CLUSTER KEYSLOT kullanici:1001
redis-cli -c -h node1 -p 6379 GET kullanici:1001

What it does

Checks that all nodes see the same slot map, that all 16384 slots are assigned and that there are no incomplete (migrating/importing) slots; fixes problems found and shows which slot/node a key lives on.

When to use it

When cluster_state:fail appears, clients get CLUSTERDOWN or constant MOVED/ASK errors, and after an interrupted reshard.

Caution

--cluster fix may assign unowned slots to arbitrary nodes and move keys in open slots; review the check output first. If a master and all its replicas are lost, the data in those slots is gone; fix only assigns the slot empty to another node. With cluster-require-full-coverage yes (default), a single unowned slot stops writes on the whole cluster.

Open in DBAtlas →

Related