Generated by GPT-5-mini| Redis Cluster | |
|---|---|
| Name | Redis Cluster |
| Developer | Salvatore Sanfilippo and Redis Labs |
| Initial release | 2015 |
| License | BSD |
Redis Cluster
Redis Cluster provides distributed key-value storage designed for horizontal scale, fault tolerance, and high throughput. It implements automatic data partitioning, asynchronous replication, and simplified availability semantics to serve large-scale caching, session storage, and real-time analytics workloads. Redis Cluster is commonly deployed alongside technologies such as Linux, Docker (software), Kubernetes, Amazon Web Services, and Google Cloud Platform.
Redis Cluster emerged to address scaling limits of single-instance deployments used by organizations like GitHub, Pinterest, Stack Overflow, and Flickr. It distributes a key-space across multiple nodes and tolerates node failures with a combination of master-replica relationships and quorum-based failover influenced by distributed-systems research such as Paxos and Raft ideas. Typical use cases include web caching for Facebook, leaderboards for Riot Games-style services, and rate limiting for API platforms like Twitter-scale systems.
The cluster architecture composes independent Redis server instances into a cooperative group where responsibility is divided via logical partitions. Each node runs the Redis server implemented in C (programming language), exposes the same command set as standalone Redis, and participates in a gossip-based peer discovery protocol similar in spirit to mechanisms in Cassandra and Consul (software). Nodes maintain metadata about cluster topology, slot assignment, and node state; cluster configuration is stored in files and propagated through cluster slots migration processes analogous to techniques used in ZooKeeper and Etcd (software). Administrators often manage clusters with orchestration platforms such as Ansible, Terraform, and container runtimes like Docker Swarm.
Redis Cluster partitions key-space into 16,384 hash slots deterministically mapped via a CRC16-based hash. Each master node is assigned a subset of these slots; keys are placed into slots using the same CRC16 hash function, enabling O(1) slot lookup per key without a centralized coordinator. Slot assignment and migration permit online resharding during scale-out events, a design comparable to sharding models used by MongoDB and Elasticsearch. Clients implement redirect logic (MOVED/ASK responses) to direct requests to the correct node, a behavior paralleling client-side routing found in Memcached consistent-hashing libraries used by Facebook.
High availability in the cluster relies on asynchronous master-replica replication: each master may have one or more replicas that replicate data via an incremental synchronization protocol. When a master fails, replicas coordinate a failover election using majority-based rules; a promoted replica becomes the new master if it has the most up-to-date data and sufficient votes from other nodes. The failover process draws conceptual parallels to leader election in Raft and the quorum concepts formalized by Leslie Lamport. Operators commonly provision odd numbers of master nodes and replicas to tolerate multiple failures, a capacity planning approach shared with systems like Hadoop and Apache ZooKeeper.
Operational tasks include adding and removing nodes, resharding, monitoring, and performing rolling upgrades. Operators use CLI tools and clients for rebalancing slots and migrating keys with minimal downtime; these procedures resemble maintenance workflows for MySQL sharded topologies and PostgreSQL replication. Monitoring integrates with time-series platforms such as Prometheus and Grafana for metrics like keyspace hits, latency, replication offset, and cluster state events. Backup and restore strategies vary from synchronous snapshotting with RDB files to AOF strategies similar to write-ahead logging used in Oracle Database and Microsoft SQL Server.
Redis Cluster must be deployed with network isolation, authentication, and optional TLS encryption for secure production use. Admins commonly place clusters within private subnets of Amazon VPC or Google VPC and control access via security groups or firewall rules modeled after practices for Azure Virtual Network. Authentication uses Redis AUTH tokens; TLS/SSL support allows encrypted client-server and inter-node communication, paralleling transport protections used in OpenSSL-enabled services. Role-based access and audit trails are typically implemented at the orchestration or perimeter level using identity providers like OAuth 2.0 gateways or LDAP integration in enterprise deployments.
Redis Cluster delivers low-latency operation and high throughput for workloads dominated by simple key operations; real-world deployments report sub-millisecond latencies on modern Intel-based servers and high operations-per-second figures under pipelined clients and event-looped frameworks like Node.js and Netty. However, the cluster has limitations: multi-key operations that span different hash slots require client-side coordination or use of hash tags to force colocated keys, a restriction absent in some distributed databases like Cassandra and CockroachDB. Strong transactional guarantees and linearizability across multiple keys are limited; for full serializability operators may favor systems such as Google Spanner or combine Redis with external coordination via Zookeeper. Other operational constraints include complexity of manual resharding under heavy write load and potential split-brain scenarios if network partitions compromise quorum assumptions, issues also faced by distributed systems like Etcd and Consul (software).
Category:Distributed databases