Skip to content
Guides & References

Redis high availability for rConfig

Make Redis highly available for rConfig with replication, three Sentinels and a VIP that follows the primary, so rConfig keeps one REDIS_HOST.

High AvailabilityUpdated
On this page

Redis high availability for rConfig

Redis holds rConfig’s job queue, cache, user sessions and locks. rConfig connects to a single Redis address, so the design is simple to state: the Redis technology handles replication and failover, and a virtual IP in front always points at the current primary. This page covers that design. On EL10, Valkey replaces Redis; see Valkey, which follows the same design.


What rConfig needs

  • One address in REDIS_HOST that always reaches the current primary.
  • One password on every Redis node, the same as rConfig’s REDIS_PASSWORD.
  • No eviction. Redis must never drop keys to save memory; that silently drops queued jobs.

The design

Part What it does
Redis primary and replica (two or more nodes) The primary takes writes; replicas copy it continuously
Sentinel (three instances) Watches the primary, agrees by majority when it has failed, promotes a replica, and repoints the others to it
VIP Always held by the node that is the current primary. rConfig’s REDIS_HOST is the VIP
Figure HA-7a: the active rConfig node uses REDIS_HOST 192.0.2.40, a VIP on primary redis1 that replicates to redis2, watched by three Sentinels; after failover redis2 is primary and holds the VIP
Figure HA-7a: Redis high availability. Sentinel promotes a replica, and the VIP follows the primary. Click the diagram to open the interactive version.

Three Sentinels are needed so they can agree by majority; run them on three separate hosts (the two Redis nodes and a third, small host is common).

The VIP follows the primary in one of two ways:

  • keepalived with a role check on each Redis node. A check script asks the local Redis for its role; only the node reporting role:master holds the VIP.
  • Sentinel’s client-reconfig-script, which runs when Sentinel promotes a replica and moves the VIP to the new primary.
/etc/keepalived/check_redis_primary.sh
#!/bin/bash
# Exit 0 only when the local Redis is the primary. keepalived gives the VIP to that node.
REDISCLI_AUTH="$(cat /etc/redis/rconfig.pass)" \
redis-cli -h 127.0.0.1 -p 6379 info replication 2>/dev/null | grep -q '^role:master'

Settings that matter on every Redis node

redis.conf (excerpt)
requirepass <the shared password>
masterauth <the shared password> # so replicas can authenticate to the primary
maxmemory 2gb # size for your queue
maxmemory-policy noeviction
appendonly yes # persistence, so a restarted node keeps its data

Sentinel needs the password too (sentinel auth-pass). Set the same password on rConfig’s nodes as described in Redis shared with other nodes: secure Redis once, then copy the password, never run the secure command on every node.


What a failover costs

  • Queued jobs written to the old primary but not yet replicated are lost. Scheduled tasks come round again at their next interval; re-run any manual download that was in flight.
  • User sessions live in Redis, so users may need to log in again.
  • Horizon reconnects to the VIP and carries on with the jobs that survived.

For rConfig, that’s usually a short interruption, not data loss that matters: device configs are collected again on the next run.


Type to search.