Skip to content

repl: streaming replication and sync state

Check synchronous standby settings, downstream replication lag, and standby upstream/replay progress.

Reads sys_stat_replication, synchronous_standby_names / synchronous_commit, and standby receiver/replay views (sys_stat_wal_receiver, sys_is_wal_replay_paused()). Read-only: never modifies configuration or pauses/resumes replay; use kbdiag cluster for repmgr topology.

Lag values are descriptive only. A standby replaying no new writes on an idle primary shows rising last replayed transaction age even with zero byte lag.

Usage

kbdiag repl
kbdiag repl --json

Key Options

OptionEffect
--jsonEmit structured JSON (repl.sync, inst.upstream, repl.replay, repl.downstreams)

Verdict & Reading Output

  • WARN (exit=1):
    • inst.upstream: standby has no WAL receiver or last_msg_age_s exceeds wal_receiver_timeout.
    • repl.replay_paused: sys_is_wal_replay_paused() is true on standby.
    • repl.sync_short: active sync/quorum candidates are fewer than synchronous_standby_names requires under on/remote_write/remote_apply.
  • UNKNOWN (exit=3): probe error/skip, unparsable synchronous_standby_names, or masked replication state ([REDACTED]).

Example (KES V9 Standby, COLUMNS=80)

repl  WARN  (standby, system@local, endpoint=/tmp/.s.KINGBASE.54321,
    2026-12-02T16:18:25Z)
[FINDINGS]
  WARN inst.upstream: the standby has no WAL receiver and is not receiving WAL
    from the primary: if the primary fails now, no standby can take over
[UPSTREAM]
  status    (no walreceiver process)
[REPLAY]
  received                   10/3F4D2A00
  replayed                   10/3F4D2A00  (caught up with what was received)
  last replayed transaction  2d 9h ago
  paused                     no
[DOWNSTREAMS]
  0
  No downstream replicas observed
[NEXT]
  verify: kbdiag slots  # run on the primary: is this standby's slot inactive?
  • kbdiag cluster — repmgr node topology, primary visibility, and failover events
  • kbdiag slots — inactive replication slots, WAL retention, and stale xmin
  • kbdiag wal — WAL position, sys_wal size, and archive backlog