PG_AUTOCTL_WATCH(1)

πŸ“¦
version 2.1 Β· 2 versions
, in fedora 43, fedora 44

πŸ’– pg_autoctl watch β€” the auto-updating dashboard era πŸ’–

okay bestie, buckle up, this is pg_autoctl watch, part of pg_auto_failover (the pg_autoctl command suite, manual section 1). it's literally a dashboard that refreshes itself, no cap. ✨


🌈 NAME 🌈

pg_autoctl watch β€” pg_autoctl watch

pg_autoctl watch β€” displays an auto-updating dashboard πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

this command outputs the events that the pg_auto_failover events records about state changes of the pg_auto_failover nodes managed by the monitor:

usage: pg_autoctl watch  [ --pgdata --formation --group ]

--pgdata      path to data directory
--monitor     show the monitor uri
--formation   formation to query, defaults to 'default'
--group       group to query formation, defaults to all
--json        output data in the JSON format

πŸ’… OPTIONS πŸ’…

  • --pgdata β€” where the Postgres node being managed locally lives. defaults to the environment variable PGDATA. and listen: use --monitor if you wanna connect to a monitor from literally anywhere, instead of using the monitor URI that a local Postgres node managed with pg_autoctl is already using. 🫢
  • --monitor β€” the Postgres URI used to connect to the monitor. it must use the autoctl_node username and target the pg_auto_failover database name, no exceptions bestie. also you can show the Postgres URI from the monitor node using the command pg_autoctl show uri. πŸ’–
  • --formation β€” lists the events recorded for nodes in the given formation. defaults to default.
  • --group β€” limits the output to a single group in the formation. defaults to including all groups registered in the target formation.

🌸 ENVIRONMENT 🌸

  • PGDATA β€” Postgres directory location. can be used instead of the --pgdata option. πŸ’œ
  • PG_AUTOCTL_MONITOR β€” Postgres URI to connect to the monitor node, can be used instead of the --monitor option.
  • XDG_CONFIG_HOME β€” the pg_autoctl command stores its configuration files in the standard place XDG_CONFIG_HOME. see the XDG Base Directory Specification. πŸ“
  • XDG_DATA_HOME β€” the pg_autoctl command stores its internal states files in the standard place XDG_DATA_HOME, which defaults to ~/.local/share. see the XDG Base Directory Specification. πŸ“

✨ DESCRIPTION ✨

the pg_autoctl watch output is divided into 3 sections, and each one is doing its own little thing. let's get into it. πŸ¦‹

🧚 section one: the header line

the first section is a single header line. it includes the name of the currently selected formation, the formation replication setting Number Sync Standbys, and then in the right most position, the current time. ⏰

πŸ“ section two: one line per node

the second section displays one line per node, and each line contains a list of columns that describe the current state for that node. this list can include the following columns β€” and which columns actually show up depends on your terminal window size. this choice is dynamic and changes if your terminal window size changes. so yes, resize your terminal and watch it glow up in real time. 😭✨

  • Name β€” name of the node.
  • Node, or Id β€” node information. when the formation has a single group (group zero), then this column only contains the nodeId.

only Citus formations allow several groups. when using a Citus formation the Node column contains the groupId and the nodeId, separated by a colon, such as 0:1 for the first coordinator node.

  • Last Report, or Report β€” time interval between now and the last known time when a node has reported to the monitor, using the node_active protocol.

this value is expected to stay under 2s or abouts, and is known to increment when either the pg_autoctl run service is not running, or when there is a network split. πŸ’€

  • Last Check, or Check β€” time interval between now and the last known time when the monitor could connect to a node's Postgres instance, via its health check mechanism.

this value is known to increment when either the Postgres service is not running on the target node, when there is a network split, or when the internal machinery (the health check worker background process) implements jitter.

  • Host:Port β€” hostname and port number used to connect to the node.
  • TLI: LSN β€” timeline identifier (TLI) and Postgres Log Sequence Number (LSN).

the LSN is the current position in the Postgres WAL stream. this is a hexadecimal number. see pg_lsn for more information.

the current timeline is incremented each time a failover happens, or when doing Point In Time Recovery. a node can only reach the secondary state when it is on the same timeline as its primary node. πŸ‘‘

  • Connection β€” this output field contains two bits of information. first, the Postgres connection type that the node provides, either read-write or read-only. then the mark ! is added when the monitor has failed to connect to this node, and ? when the monitor didn't connect to the node yet.
  • Reported State β€” the current FSM state as reported to the monitor by the pg_autoctl process running on the Postgres node.
  • Assigned State β€” the assigned FSM state on the monitor. when the assigned state is not the same as the reported start, then the pg_autoctl process running on the Postgres node might have not retrieved the assigned state yet, or might still be implementing the FSM transition from the current state to the assigned state. πŸ™ˆ

🌈 section three: the events feed

the third and last section lists the most recent events that the monitor has registered. the more recent event is found at the bottom of the screen. πŸ“œ


ok quitting time: to quit the command hit either the F1 key or the q key. that's it. that's the whole exit strategy. πŸ’…

πŸ‘‘ AUTHOR πŸ‘‘

Microsoft


Copyright (c) Microsoft Corporation. All rights reserved.


and that's the whole vibe check, bestie β€” this was pg_autoctl watch from pg_auto_failover version 2.1, dated Jan 18, 2025, manual section 1. go forth and watch those nodes slay. πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from