Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. Download free →
CLSkills
DatabaseadvancedNew

Redis Cluster

Share

Configure Redis Cluster for high availability and sharding

Works with OpenClaude

You are a Redis infrastructure engineer. The user wants to configure Redis Cluster for high availability and sharding across multiple nodes.

What to check first

  • Ensure Redis 3.0+ is installed on all nodes (redis-server --version)
  • Verify network connectivity between all planned cluster nodes on port 6379 and 16379 (cluster bus port)
  • Check that each node has at least 3GB free memory and cluster-enabled is disabled in redis.conf initially

Steps

  1. Edit /etc/redis/redis.conf on each node and set cluster-enabled yes, cluster-config-file nodes-<port>.conf, and cluster-node-timeout 15000
  2. Start Redis on all nodes with redis-server /etc/redis/redis.conf (do NOT use --cluster-enabled flag; use config file)
  3. Run redis-cli --cluster create <node1-ip>:6379 <node2-ip>:6379 <node3-ip>:6379 <node4-ip>:6379 <node5-ip>:6379 <node6-ip>:6379 --cluster-replicas 1 to initialize the cluster (3 masters + 3 replicas minimum)
  4. Verify cluster status with redis-cli -h <any-node-ip> cluster info and redis-cli -h <any-node-ip> cluster nodes
  5. Test failover by stopping a master node and confirming its replica is promoted via cluster info on remaining nodes
  6. Configure client connection pooling to use CLUSTER NODES responses for slot-to-node mapping (use redis-py with RedisCluster, node-redis with cluster, or similar)
  7. Monitor cluster health with redis-cli -h <node-ip> --stat and watch cluster_state:ok in cluster info output
  8. Set cluster-migration-barrier 1 and cluster-require-full-coverage no in redis.conf for production resilience

Code

import redis
from rediscluster import RedisCluster

# Define initial cluster nodes (use any node in the cluster)
startup_nodes = [
    {"host": "192.168.1.10", "port": 6379},
    {"host": "192.168.1.11", "port": 6379},
    {"host": "192.168.1.12", "port": 6379},
]

# Create cluster connection with connection pooling
rc = RedisCluster(
    startup_nodes=startup_nodes,
    decode_responses=True,
    skip_full_coverage_check=True,
    connection_pool_kwargs={
        "max_connections": 50,
        "socket_connect_timeout": 5,
        "socket_keepalive": True,
    },
)

# Test cluster operations
try:
    # Set keys (automatically distributed across slots)
    for i in range(100):
        rc.set(

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategoryDatabase
Difficultyadvanced
Version1.0.0
AuthorClaude Skills Hub
redisclusterhigh-availability

Install command:

curl -o ~/.claude/skills/redis-cluster.md https://clskills.in/skills/database/redis-cluster.md

Related Database Skills

Other Claude Code skills in the same category — free to download.

Want a Database skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.