PG_AUTOCTL_SHOW_EVENTS(1)
β¨ NAME β¨
pg_autoctl show events β bestie, this is the one that spills the tea β on everything the monitor has been watching. It prints out the monitor's state of nodes in a given formation and group, so you can see every little glow-up your pg_auto_failover nodes went through.
πΈ 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 show events [ --pgdata --formation --group --count ]
--pgdata path to data directory
--monitor pg_auto_failover Monitor Postgres URL
--formation formation to query, defaults to 'default'
--group group to query formation, defaults to all
--count how many events to fetch, defaults to 10
--watch display an auto-updating dashboard
--json output data in the JSON format
π OPTIONS π
--pgdataβ where your local Postgres node lives, like, the actual location of the data directory of the node being managed locally. It defaults to the environment variablePGDATA. And heads up, bestie: use--monitorif you wanna connect to a monitor from anywhere, instead of using the monitor URI that a local Postgres node managed withpg_autoctlis using. π«Ά--monitorβ the Postgres URI used to connect to the monitor. It must use theautoctl_nodeusername and target thepg_auto_failoverdatabase name. No cap, that part is not negotiable. If you need to see the Postgres URI from the monitor node itself, you can runpg_autoctl show uri. π₯--formationβ list the events recorded for nodes in the given formation. Defaults todefault. π--countβ by default only the last10events are printed. That's it, that's the whole thing. π--watchβ okay this one is main character energy: it takes control of the terminal and displays the current state of the system plus the last events from the monitor. The display updates automatically every500milliseconds (half a second, literally) and it reacts properly to window size change. Iconic. π¦
Depending on the terminal window size, a different set of columns is visible in the state part of the output. See pg_autoctl watch. π
--jsonβ output a JSON formatted data instead of a table formatted list. For when you wanna pipe it somewhere cute. β
π ENVIRONMENT π
PGDATAβ Postgres directory location. Can be used instead of the--pgdataoption. πΈPG_AUTOCTL_MONITORβ Postgres URI to connect to the monitor node, can be used instead of the--monitoroption. πXDG_CONFIG_HOMEβ thepg_autoctlcommand stores its configuration files in the standard placeXDG_CONFIG_HOME. See the XDG Base Directory Specification. π§XDG_DATA_HOMEβ thepg_autoctlcommand stores its internal states files in the standard placeXDG_DATA_HOME, which defaults to~/.local/share. See the XDG Base Directory Specification. π
π EXAMPLES π
Not me showing you the receipts in JSON form:
$ pg_autoctl show events --count 2 --json
[
{
"nodeid": 1,
"eventid": 15,
"groupid": 0,
"nodehost": "localhost",
"nodename": "node1",
"nodeport": 5501,
"eventtime": "2021-03-18T12:32:36.103467+01:00",
"goalstate": "primary",
"description": "Setting goal state of node 1 \"node1\" (localhost:5501) to primary now that at least one secondary candidate node is healthy.",
"formationid": "default",
"reportedlsn": "0/4000060",
"reportedstate": "wait_primary",
"reportedrepstate": "async",
"candidatepriority": 50,
"replicationquorum": true
},
{
"nodeid": 1,
"eventid": 16,
"groupid": 0,
"nodehost": "localhost",
"nodename": "node1",
"nodeport": 5501,
"eventtime": "2021-03-18T12:32:36.215494+01:00",
"goalstate": "primary",
"description": "New state is reported by node 1 \"node1\" (localhost:5501): \"primary\"",
"formationid": "default",
"reportedlsn": "0/4000110",
"reportedstate": "primary",
"reportedrepstate": "quorum",
"candidatepriority": 50,
"replicationquorum": true
}
]
π AUTHOR π
Microsoft
π COPYRIGHT π
Copyright (c) Microsoft Corporation. All rights reserved.
okay that's the whole page, you ate that π version2.1, datedJan 18, 2025, from the pg_auto_failover crew β mwah, go run it bestie π«Άβ¨
π¦ where this page comes from
- fedora 43: pg_auto_failover 2.1-6.fc42 Β· Apache-1.0
- fedora 44: pg_auto_failover 2.1-6.fc42 Β· Apache-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms