Introduction
Redis cluster slot not covered when no node owns the hash slot or cluster state invalid. This guide provides step-by-step diagnosis and resolution.
Symptoms
Typical error output:
Error: MOVED 1234 10.0.0.1:6379
CLUSTERDOWN Hash slot not served
No node owns hash slot 1234Common Causes
- 1.No node assigned to own the hash slot
- 2.Cluster state is fail due to missing slots
- 3.Node holding slot failed without replica
- 4.Slot migration incomplete
Step-by-Step Fix
Step 1: Check Current State
redis-cli cluster info
redis-cli cluster nodes
redis-cli cluster slotsStep 2: Identify Root Cause
redis-cli INFO
redis-cli CONFIG GET "*"
redis-cli SLOWLOG GET 10Step 3: Apply Primary Fix
```bash # Assign slot to node redis-cli -h <node-ip> -p 6379 CLUSTER ADDSLOTS 1234
# Or reshard to rebalance redis-cli --cluster reshard <node-ip>:6379 --cluster-from <source-id> --cluster-to <target-id> --cluster-slots 1000 --cluster-yes ```
Step 4: Apply Alternative Fix
```bash # Alternative fix: Check configuration redis-cli CONFIG GET "*memory*" redis-cli CONFIG GET "*timeout*"
# Update settings redis-cli CONFIG SET parameter value
# Verify the fix redis-cli INFO ```
Step 5: Verify the Fix
redis-cli cluster info
redis-cli cluster slots
# state:ok and all slots coveredCommon Pitfalls
- Not using connection pooling for high-throughput applications
- Setting maxmemory without eviction policy
- Using KEYS command in production
- Not monitoring replication lag
Best Practices
- Monitor Redis memory and fragmentation regularly
- Use SCAN instead of KEYS for key enumeration
- Configure appropriate eviction policy for workload
- Implement proper backup strategy (RDB or AOF)
Related Issues
- Redis Connection Refused
- Redis High Latency
- Redis Cluster Down
- Redis Persistence Failed