Redis High Availability
Redis uses unidirectional asynchronous replication from the primary instance (also referred to as “master”) to secondary replicas (or “slaves”). A primary instance may have any number of replicas, and any of the replicas may have additional replicas of themselves. To ensure minimal latencies of all operations, replication is non-blocking and is performed after a given operation has been executed by the primary instance. In the event that the primary instance has failed post execution but pre replication, data may be lost. In order to ensure data consistency, it is possible for the client to block until any number of replicas have been updated.
Redis replica can be added and configured at runtime, and the replication protocol supports both a full and partial synchronization for optimizing the network bandwidth consumption. Replicas can be set up to act solely as hot standbys, serve only read requests and even allow write operations (although the latter are not sent back to the master and may be overwritten by the replication stream).
A Redis replica by itself isn't enough to maintain the availability of the service, as it needs to be promoted to the role of primary instance in the event of failure. For failover and full promotion to happen, the replica must have its role switched, have all other replicas replicate off of it and have all clients reconnect to it for accessing the data.
When using Redis in single instance mode, in which a single Redis server manages the entire unpartitioned database, Redis Sentinel is used to manage its availability. Sentinel is a component of the Redis server that must be deployed in addition to the data's server and replicas. Sentinel is based on achieving quorum consensus in failure detection, so it requires the deployment of several of its instances near the data instances to monitor them. When a majority of the Sentinels agree on the failure of a primary instance, one of its replicas is automatically promoted. Redis Sentinel also provides a service discovery interface that clients use to connect to the primary Redis instance.
A Conceptual Overview
Redis is an open source in-memory data structure store that is designed to be fast and simple. Built for real-time performance, most requests to Redis complete in less than a millisecond allowing a single server to handle millions of concurrent requests every second. For ensuring service continuity, built-in replication, service discovery and failover mechanisms are provided by Redis cluster and Redis Sentinel when using a non-clustered database configuration,
A single server is a single point of failure in every system, and in order to ensure the high availability of the service, that server needs to be made redundant. Making a server redundant typically consists of maintaining multiple instances of that server and switching between them as needed.
A Redis instance is a server process that acts as the in-memory data store. By default, it takes the role of a single primary source of the data, and serves all read and write requests for it. To protect against the primary process' failure, whether due to software or hardware issues, Redis can replicate the dataset, as well as the stream of changes it undergoes, to one or more secondary instances or replicas.
A Redis cluster, in which data is partitioned among multiple primary instances, manages availability by itself and requires no extra components. Every clustered primary instance can have its own set of replicas, and the cluster's members detect failures amongst themselves via the internal interconnect. Both master and slave instances are members in the cluster, and once a majority of members agree on a primary instance's failure, one of its replicas is promoted automatically. The Redis cluster interface and protocol are designed to allow clients to discover the cluster's topology, and provides redirection in case of changes.
Redis Enterprise: A Reliable Database
Redis Enterprise was built from the ground up to provide a shared-nothing symmetric architecture cluster on the top of open source Redis. Redis Enterprise is an extremely reliable database due to its combination of fast replication, robust auto-failover, various data persistence options, efficient cluster recovery, active-active and active-passive deployments. Redis Enterprise exposes three types of interfaces to manage your database in a highly available manner:
These features are summarized below:
When tested in a real-life scenario we were not surprised to see that among all the other Redis services out there, Redis Enterprise is the only product that can instantly recover from a failure event without losing data:
Download our benchmark on the Six Essential Features of Highly Available Redis.
Start Your Free Trial
Select Deployment Option:
Downloadable software for any cloud or private data center.
Fully managed Redis-e database-as-a-service in your virtual private cloud within major public clouds.
REDIS ENTERPRISE VPC
The fastest way to deploy a Redis database.
Fully managed, serverless and hosted database-as-a-service on major public clouds.
REDIS ENTERPRISE CLOUD