Redis Cluster Number of Slots: Complete Configuration Review
Redis Cluster divides data across 16384 hash slots for scalability. Understanding slot allocation is key to sharding, resharding, and performance tuning. This listicle reviews slot mechanics, commands, and best practices.
Default Number of Slots: 16384
Fixed at 16384 for consistent hashing. Each node owns a subset; clients compute slot via CRC16 key % 16384.
Slot Assignment Commands
Use
CLUSTER ADDSLOTS to claim, CLUSTER DELSLOTS to release.
- CLUSTER SLOTS: List ranges
- CLUSTER NODES: Ownership view
Resharding Slots Live
Migrate slots without downtime:
redis-cli --cluster reshard. Move 1000 slots incrementally.
Optimal Slot Distribution
Aim for even spread: 16384 / node count. Monitor with
CLUSTER INFO.
Handling Slot Migration Failures
Timeouts? Increase
cluster-migration-barrier. Use CLUSTER FORGET for stuck nodes.
Advanced: Custom Slot Counts
Not recommended; requires full recluster. Stick to 16384 for compatibility.
Monitoring Tools for Slots
RedisInsight visualizes slots; Prometheus exporter for metrics.
Common Pitfalls with Slots
Uneven slots cause hotspots; always pre-warm new nodes.
Frequently Asked Questions
What is the number of slots in Redis Cluster?
Always 16384 hash slots for key sharding.
How to check slot ownership?
Use CLUSTER SLOTS or CLUSTER NODES.
Can I change the slot number?
No, it's hardcoded. Reshard instead.
What causes slot migrations?
Node addition/removal triggers automatic or manual resharding.