Setting up Redis Sentinel for High Availability

We often encounter a situation: the Redis master fails, and the application loses cache or sessions for several minutes. Manual switching to a replica takes 5–15 minutes of downtime, lost transactions, and stress. Without automation, you have to manually log in to the server, run `SLAVEOF NO ONE`, a

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1419
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1287
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    983
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1244
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    983
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    998

We often encounter a situation: the Redis master fails, and the application loses cache or sessions for several minutes. Manual switching to a replica takes 5–15 minutes of downtime, lost transactions, and stress. Without automation, you have to manually log in to the server, run SLAVEOF NO ONE, and reconfigure client applications. This is time-consuming and error-prone, especially during nights or weekends. The solution is Redis Sentinel: a system that automatically detects master failure, promotes a new master, and notifies clients. Sentinel is 10 times faster than manual switching—failover takes 10-20 seconds. Client libraries like phpredis and predis support automatic redirection to the new master without code changes. With proper configuration, the application loses at most 20 seconds of connection before resuming with the new replica.

Why three Sentinels?

Sentinel uses a voting algorithm: when contact with the master is lost, each Sentinel proposes promoting a replica. A decision is made only with a quorum—a majority of votes. With two Sentinels, split-brain is possible (each considers its candidate master). Three servers with quorum = 2 guarantee a correct failover.

How to configure Redis Master and Replica in 6 steps

  1. Install Redis on all three servers (same version, e.g., 7.2).
  2. Configure the master—set passwords, memory limit, enable AOF.
  3. Configure replicas—add parameter replicaof <master-ip> 6379.
  4. Configure Sentinel—create sentinel.conf with monitor, password, and timeout settings.
  5. Start Sentinel on all servers with redis-sentinel /etc/redis/sentinel.conf.
  6. Check the status—run SENTINEL masters to confirm the master is detected.

Example master config (/etc/redis/redis.conf):

bind 0.0.0.0 port 6379 requirepass RedisPassword123 masterauth RedisPassword123 maxmemory 4gb maxmemory-policy volatile-lru appendonly yes appendfsync everysec protected-mode no 

Replica config is the same but add replicaof <master-ip> 6379 and replica-read-only yes.

Example Sentinel config (/etc/redis/sentinel.conf on each server, only sentinel announce-ip changes):

port 26379 daemonize yes logfile /var/log/redis/sentinel.log sentinel monitor mymaster <master-ip> 6379 2 sentinel auth-pass mymaster RedisPassword123 sentinel down-after-milliseconds mymaster 5000 sentinel parallel-syncs mymaster 1 sentinel failover-timeout mymaster 60000 sentinel notification-script mymaster /opt/redis/notify.sh sentinel announce-ip <server-ip> sentinel announce-port 26379 

How to test failover without risk?

We recommend simulating before production:

  1. Stop the master: systemctl stop redis.
  2. Observe Sentinel logs—failover should begin within 5–15 seconds.
  3. Check the new master: SENTINEL master mymaster—the ip field will change.
  4. Start the old master again: systemctl start redis—it will automatically become a replica of the new master.

Common testing mistakes:

  • Passwords not verified—failover may fail due to auth-pass.
  • Too large down-after-milliseconds—delay up to 30 seconds.
  • Missing notification-script—you won't know about master change.
What to do if Sentinel cannot reach quorum? Check network connectivity between servers (ports 26379 must be open). Ensure the config has the correct `sentinel announce-ip`. If servers are behind NAT, explicit external IPs may be required. For debugging, use `SENTINEL ckquorum mymaster`.

Comparison: Sentinel vs. Redis Cluster

Criterion Redis Sentinel Redis Cluster
Data volume Fits in one server's RAM Exceeds one server's RAM
Fault tolerance Automatic failover Automatic failover and resharding
Write location Only master Any node (sharding)
Setup complexity Low High
Multi-key operations Full support Limited to same slot

For 90% of projects with data volumes up to 64 GB, Sentinel is the optimal choice.

Comparison of downtime

Method Average downtime
Manual switch 10 minutes
Redis Sentinel 15 seconds

By automating, you save dozens of hours per year and eliminate human error.

What is included in the turnkey setup

We provide:

  • Configuration of Master+Replica+Sentinel on 3 servers
  • Quorum and failover mechanism verification
  • Notification setup (Telegram, email) on master change
  • Failover test script
  • Client integration (Laravel, Symfony, plain PHP)
  • Operations documentation

We have implemented Sentinel in over 50 projects—experience shows that 80% of incidents resolve automatically without engineer intervention. According to official Redis Sentinel documentation, this configuration ensures 99.9% availability when properly configured.

Timeline and guarantees

Standard setup of Sentinel with three servers, failover testing, and integration takes 1 to 2 business days. Cost is calculated individually. The investment pays off through reduced downtime. We offer a 30-day guarantee on the correct operation of the fault tolerance scheme.

Order Redis Sentinel setup—and forget about manual switching. Get an engineer consultation to estimate the cost for your project.

Note: In the configurations above, use your own password and IP addresses. Do not forget to open ports 6379 (Redis) and 26379 (Sentinel) in the firewall.