Databases 11 min read

Redis Deployment Modes: Single Instance, Cluster, and Sentinel – Features, Comparison, and Client Options

This article explains Redis as an open‑source in‑memory data store, compares its main deployment modes—single instance, Redis Cluster, and Redis Sentinel—detailing their architectures, replication, sharding, failover mechanisms, client options, and backup strategies such as RDB and AOF.

Architecture Digest
Architecture Digest
Architecture Digest
Redis Deployment Modes: Single Instance, Cluster, and Sentinel – Features, Comparison, and Client Options

Redis is an open‑source (BSD‑licensed) in‑memory data‑structure store that can serve as a database, cache, or message broker.

The article introduces the most common Redis deployment modes—single instance, Redis Cluster, and Redis Sentinel—and provides a simple comparison of their characteristics.

Single Instance Mode runs a single Redis process on one machine, offering no fault tolerance or resource sharing, which can lead to waste when only one instance is used.

Redis Cluster is a distributed set of nodes that provides replication, high availability, and sharding without requiring Sentinel. Nodes communicate peer‑to‑peer, distribute 16,384 hash slots among masters, and automatically redirect commands to the correct node. The cluster handles automatic failover, node fault detection, and supports horizontal scaling up to thousands of nodes.

The core goals of Redis Cluster, as described in the official documentation, are performance (using P2P, asynchronous replication, and client redirection), horizontal scalability (linear scaling to ~1000 nodes), and availability (built‑in monitoring and failover similar to Sentinel).

Redis Sentinel is a monitoring and failover system for Redis instances. It continuously checks the health of masters and slaves, sends notifications, and promotes a slave to master when a failure occurs, providing high availability without requiring a separate cluster setup.

Backup strategies include RDB snapshots (periodic point‑in‑time dumps) and AOF (append‑only file) logging of all write commands. RDB offers fast recovery but may lose recent data; AOF provides near‑zero data loss at the cost of growing file size.

Typical deployment recommendations: avoid backup on primary instances to reduce load; use AOF (optionally with RDB) on slaves and back up AOF daily to a separate server. This minimizes resource impact on the primary while ensuring data safety.

Client support for Redis Cluster varies by language. Notable clients include:

redis‑rb‑cluster (Ruby)

predis (PHP)

jedis (Java)

StackExchange.Redis (C#)

redis‑cli with the -c flag

Using Sentinel with Python (redis‑py) involves creating a Sentinel object, obtaining master and slave StrictRedis instances, and handling ConnectionError or MasterNotFoundError during failover.

In Java, the Jedis library (e.g., jedis‑2.1.0.jar) together with a connection pool (e.g., commons‑pool‑2.4.2.jar) can be used; a JedisTemplate abstracts connection acquisition and release.

Additional notes: in cluster mode, slaves do not accept reads/writes unless promoted; the client does not support bulk KEYS or SELECT commands; JedisCluster cannot dispatch certain single‑node commands; and byte‑array APIs may need custom extensions.

Finally, the source includes a promotional block for the SDCC 2017 Shanghai event and a discount code, which is unrelated to the technical content.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

databaseDeploymentshardingredissentinelCluster
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.