Skip to content

RTFM · Healthchecks

lb.saphira.redis: does it answer PING with PONG?

Redis's own health question, asked the honest way: the check says PING and demands PONG. If the server requires a password, the check authenticates first; from the environment, never echoed.

Saphira Linux dragon mascot

What it proves

A live Redis server on the RESP wire: optional AUTH (+OK required) and then PING → +PONG. A custom expect regex can pin the verdict further. Because PING exercises the command path (not just the socket), this catches the wedged-instance case where TCP connects but the event loop is stuck.

How it works

The probe engine speaks inline commands: AUTH with the password from LB_SAPHIRA_REDIS_PASSWORD when set (a non-+OK answer fails immediately), then PING, and matches the reply; +PONG by default, or your LB_SAPHIRA_EXPECT regex.

Configuration

Knobs
VariableDefaultMeaning
LB_SAPHIRA_REDIS_PASSWORD-AUTH password: env/conf only, never echoed
LB_SAPHIRA_EXPECT-Custom reply regex instead of +PONG
LB_SAPHIRA_TIMEOUT3Round-trip deadline
(target port)$4, else 6379Any port redis-server listens on

Wiring it up

ldirectord
# ldirectord.cf - cache pool
virtual = 203.0.113.10:6379
    protocol = tcp
    scheduler = lc
    real = 192.168.20.111:6379 gate 1
    real = 192.168.20.112:6379 gate 1
    checktype = external
    checkcommand = "/var/lib/lb/saphira/lb.saphira.redis"

Run it by hand

Manual run
LB_SAPHIRA_REDIS_PASSWORD=$(cat /etc/redis/hc-pass) \
  /var/lib/lb/saphira/lb.saphira.redis cache-pool 6379 192.168.20.111 6379
echo $?
# 0 = (AUTH ok) + PONG
# 1 = AUTH refused, no PONG, or expect mismatch

Failure modes

  • NOAUTH/ERR on PING: the server requires a password the check was not given: configuration gap, exit path is 1 not silent
  • Socket accepted, no PONG; event loop wedged (persistence fork stall is the classic): this check is the early warning

Did we miss something?

If this page left something unanswered, found an error, or there is another subject you would like documented, tell us. Saphira’s documentation grows from real problems people need to solve.

Send feedback or request a new section →

Prefer not to do it yourself?

Everything needed to do the work yourself is documented here and remains free; we charge for human time, not for withholding knowledge. Sometimes the missing resource is simply time. The same people who build Saphira can provide paid professional help with implementation, migration, troubleshooting and administration.

Ask about professional support →