DBAtlas · Database operations atlas

Redis Cluster installation (3 masters + 3 replicas)

RedisLevel: IntermediateDuration: 45–60 min

Builds a Redis Cluster from scratch (Redis 7.2 / 8.2 or Valkey): the 16384 hash slots are distributed across three (or more) masters, and each master has a replica on a different server. Layout with one instance per server (6 servers) or two instances per server (3 servers), a systemd service per instance, password, cluster creation, checks and a failover test are done step by step; the result is a cluster that spreads data across the masters, fails over automatically when a server is lost and can be grown by adding nodes. If the data fits on a single server and the application uses multi-key commands, Lua or SELECT, a Sentinel setup is simpler; adding nodes, resharding and replacing a failed node are in the Redis operations guide, backup and hardening in separate guides.

Topology: 6 instances: 6 servers × 1 or 3 servers × 2

Before you start

  • All servers run the same operating system version and are up to date; clocks are synchronized with NTP (chrony).
  • RAM matches the value in the form; swap is small but defined (against OOM during fork). The disk has free space of at least twice the RAM (for RDB/AOF rewrites).
  • The servers can reach each other by IP (IPs are used in the Redis configuration).
  • Ports …, ……, …, …… are open between the servers; these ports are not used by any other service.
  • ……The servers can reach the operating system's AppStream repository (or EPEL)…The servers can reach the rpms.remirepo.net and EPEL (dl.fedoraproject.org) repositories………The servers can reach the Ubuntu universe repository…The servers can reach the packages.redis.io repository……, or an internal mirror is configured.
  • There is no other Redis/Valkey installation on the servers (version conflict).
  • You are logged in as root or with sudo rights; the maintenance window is approved.

Phases of the guide

  • Operating system preparation (all servers) — Hostname: … · Hostname: … · System update and tools · Kernel settings (sysctl) · Apply the sysctl settings
  • Installation (all servers) — Add the Remi and EPEL repositories · Add the packages.redis.io repository · Install the … software · Disable the distribution's default service · SELinux port definitions
  • Instance configuration — systemd service template (…@.service) · cluster-….conf: … · cluster-….conf: … · cluster-….conf: … · Data directories and password · Start the instances …
  • Create the cluster — Check access to all instances · Create the cluster (--cluster create) · Check the cluster (--cluster check) · Verify the replica placement
  • Verification and failover test — Write/read test · Planned failover (CLUSTER FAILOVER) · Application connection
  • Post-installation — Scaling: adding nodes and resharding (information) · Backup · Monitoring
Open the step-by-step plan for your environment →