← Start of tutorial

WIUNIX ACADEMY

Redis and Valkey Sentinel high availability on Linux

Page 7 of 8. Review the earlier steps and prerequisites before continuing.

YOUR SYSTEM. YOUR STEPS.

Where are you working?

Choose your OS and version. The prerequisites, commands and troubleshooting follow your environment.

RHEL 10.2Reviewed against official documentation ·

USE YOUR OWN VALUES

Configure this tutorial

Set the example values for your environment; related explanations and copy panels update together. Never enter passwords, private keys or tokens. Values stay in this tab and are not sent to the server or share links. Check actual DNS, certificates and network policy before running commands.

Different IP addresses, domains or ports? Open the settings below, change the values and select “Apply to tutorial”, then copy the updated commands.

Set values for my environment5 editable values
27

LET’S BUILD

Connect to the discovered primary, not a guessed address

On the approved client, replace DISCOVERED_PRIMARY_IP with the just-returned B or C address. APP secret at the prompt. The other surviving data node must have rejoined as its replica before the min-replicas policy permits writes. Run the next session on this same connection.

Bash
/usr/bin/valkey-cli --tls --cacert /etc/academy-client/ca.pem --cert /etc/academy-client/client.pem --key /etc/academy-client/client.key -h DISCOVERED_PRIMARY_IP -p 6379 --user app --askpass
How do I know it worked?

The approved client reaches the discovered endpoint over mutual TLS.

28

LET’S BUILD

Verify old data, then a new replicated write

GET must still be before-failover. SET must be OK and WAIT 1 must return 1, otherwise stop. Read the new value on the remaining replica using its local APP login as well; checking only the primary is insufficient. A different lost marker is a failed recovery result, not permission to overwrite data.

Redis CLI
ROLE
GET academy:probe
SET academy:probe after-failover
WAIT 1 5000
GET academy:probe
QUIT
How do I know it worked?

Check the role, exact values and required responses described above; stop on any unexpected result.

29

LET’S BUILD

Return the old node without restoring the old topology

On A ONLY keep application access fenced. Start its retained config/data; Sentinel should reconfigure it as a replica of the elected primary. Do not add replicaof no one, copy the bootstrap file or expose it to writers during convergence. Sentinel may replace a divergent former-primary dataset during resync; this rehearsal has no independent writes on fenced A. A real divergent node needs preserved offline evidence and a recovery decision first.

Bash
sudo systemctl start valkey
sudo systemctl status valkey --no-pager
sudo journalctl -u valkey-sentinel -n 50 --no-pager
How do I know it worked?

A starts and is reconfigured as a replica; client access remains fenced until role/data checks pass.

30

LET’S BUILD

Confirm rejoin on A and topology on every voter

On A use the Redis ADMIN login: require replica role, new master address, link up, no full sync in progress and successful persistence. APP GET on A must equal after-failover; APP SET must be READONLY. Repeat all-voter topology/quorum checks. Keep the elected primary rather than forcing an immediate failback. Only then update approved client routing and restore the intended private access policy.

Redis CLI
ROLE
INFO replication
INFO persistence
QUIT
How do I know it worked?

Check the role, exact values and required responses described above; stop on any unexpected result.

31

LET’S BUILD

Data-preserving reversal for this dedicated lab

Before retiring the LAB, stop application traffic through its owning control, fence all data endpoints and retain checked backups plus successful isolated restore evidence. Then run on A/B/C to disable automatic voting and both dedicated services. This is a maintenance outage, not a way to keep HA while removing Sentinel. Files, AOF/RDB and permissions remain intact. Never purge packages, flush data or blindly restore bootstrap roles. Re-enabling requires an explicit current-primary decision, consistent roles and fresh all-voter/data checks before opening clients.

Bash
sudo systemctl disable --now valkey-sentinel
sudo systemctl disable --now valkey
sudo systemctl is-enabled valkey-sentinel valkey
sudo ss -lntp
How do I know it worked?

Both dedicated services are disabled/inactive (nonzero is-enabled is expected); retained data/configuration remain available for recovery.

Diagnose the consequence before changing the topology

Use each diagnostic on its stated host/session. Logs can contain private topology; share only reviewed redacted extracts. An expected authorization refusal is different from a failed quorum or missing data.

Service will not start

Read the actual file log and unit result. A bad ACL token, wrong local bind IP, missing key or permission failure needs correction in the earlier protected editor. Do not launch a second daemon against the same data directory or disable TLS to make it start.

Bash
sudo systemctl status valkey valkey-sentinel --no-pager
sudo journalctl -u valkey -u valkey-sentinel -n 60 --no-pager
ip -br address
sudo -u valkey test -r /etc/valkey/tls/node.key
sudo -u valkey test -w /etc/valkey/sentinel.conf
No quorum or replicas remain disconnected

Use the earlier authenticated Sentinel session to inspect MASTER/REPLICAS/SENTINELS and CKQUORUM. Missing peers can be wrong announce IPs, blocked 26379 or PEER credentials; missing replicas can be blocked 6379, REPL/CONTROL ACLs or TLS. A voter needs writable config AND directory. Keep reserved-channel rights limited to CONTROL.

Bash
sudo ss -lntp
sudo journalctl -u valkey-sentinel -n 80 --no-pager
sudo -u valkey test -w /etc/valkey
sudo -u valkey test -w /etc/valkey/sentinel.conf
NOREPLICAS, READONLY or missing marker

NOREPLICAS is the minimum-replica policy rejecting unsafe writes: inspect the current primary replication state, rather than setting the limit to zero. READONLY at the original primary often means election succeeded and the client has a stale endpoint. Missing marker is a failed data check: fence traffic and preserve nodes for recovery. Use the ADMIN login then this CLI diagnostic session.

Redis CLI
ROLE
INFO replication
INFO persistence
QUIT
TLS or certificate renewal failure

On the affected host check expiry, trust and key readability using the earlier PKI panel. For this local certificate verification replace the IP with the node’s actual assigned IP. A successful CA check alone is not endpoint-name verification. Renew certificates with overlap and recheck all TLS paths; no --insecure workaround. Never paste private keys or secret-bearing configs into a ticket.

Bash
sudo openssl verify -CAfile /etc/valkey/tls/ca.pem -untrusted /etc/valkey/tls/node.pem -purpose sslserver -verify_ip 10.20.0.10 /etc/valkey/tls/node.pem
sudo openssl x509 -in /etc/valkey/tls/node.pem -checkend 604800 -noout
sudo -u valkey test -r /etc/valkey/tls/node.key
Disk or AOF errors

On the affected node inspect capacity, inodes and actual persistence status via the earlier ADMIN session. AOF rewrite needs temporary disk/RAM headroom. Stop adding traffic when persistence fails; do not delete AOF segments or run redis-check-aof --fix against the only copy. Preserve files and restore a checked backup in isolation before a repair decision.

Bash
df -h /var/lib/valkey /var
df -i /var/lib/valkey
sudo journalctl -u valkey -n 80 --no-pager
Explore all tutorials ↗