.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "PG_AUTOCTL SHOW STATE" "1" "Nov 06, 2022" "2.0" "pg_auto_failover" .SH NAME pg_autoctl show state \- pg_autoctl show state .sp pg_autoctl show state \- Prints monitor\(aqs state of nodes in a given formation and group .SH SYNOPSIS .sp This command outputs the current state of the formation and groups registered to the pg_auto_failover monitor: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C usage: pg_autoctl show state [ \-\-pgdata \-\-formation \-\-group ] \-\-pgdata path to data directory \-\-monitor pg_auto_failover Monitor Postgres URL \-\-formation formation to query, defaults to \(aqdefault\(aq \-\-group group to query formation, defaults to all \-\-local show local data, do not connect to the monitor \-\-watch display an auto\-updating dashboard \-\-json output data in the JSON format .ft P .fi .UNINDENT .UNINDENT .SH OPTIONS .INDENT 0.0 .TP .B \-\-pgdata Location of the Postgres node being managed locally. Defaults to the environment variable \fBPGDATA\fP\&. Use \fB\-\-monitor\fP to connect to a monitor from anywhere, rather than the monitor URI used by a local Postgres node managed with \fBpg_autoctl\fP\&. .TP .B \-\-monitor Postgres URI used to connect to the monitor. Must use the \fBautoctl_node\fP username and target the \fBpg_auto_failover\fP database name. It is possible to show the Postgres URI from the monitor node using the command \fI\%pg_autoctl show uri\fP\&. .TP .B \-\-formation List the events recorded for nodes in the given formation. Defaults to \fBdefault\fP\&. .TP .B \-\-group Limit output to a single group in the formation. Default to including all groups registered in the target formation. .TP .B \-\-local Print the local state information without connecting to the monitor. .TP .B \-\-watch Take control of the terminal and display the current state of the system and the last events from the monitor. The display is updated automatically every 500 milliseconds (half a second) and reacts properly to window size change. .sp Depending on the terminal window size, a different set of columns is visible in the state part of the output. See \fI\%pg_autoctl watch\fP\&. .TP .B \-\-json Output a JSON formatted data instead of a table formatted list. .UNINDENT .SH ENVIRONMENT .sp PGDATA .INDENT 0.0 .INDENT 3.5 Postgres directory location. Can be used instead of the \fB\-\-pgdata\fP option. .UNINDENT .UNINDENT .sp PG_AUTOCTL_MONITOR .INDENT 0.0 .INDENT 3.5 Postgres URI to connect to the monitor node, can be used instead of the \fB\-\-monitor\fP option. .UNINDENT .UNINDENT .sp XDG_CONFIG_HOME .INDENT 0.0 .INDENT 3.5 The pg_autoctl command stores its configuration files in the standard place XDG_CONFIG_HOME. See the \fI\%XDG Base Directory Specification\fP\&. .UNINDENT .UNINDENT .sp XDG_DATA_HOME .INDENT 0.0 .INDENT 3.5 The pg_autoctl command stores its internal states files in the standard place XDG_DATA_HOME, which defaults to \fB~/.local/share\fP\&. See the \fI\%XDG Base Directory Specification\fP\&. .UNINDENT .UNINDENT .SH DESCRIPTION .sp The \fBpg_autoctl show state\fP output includes the following columns: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Name .INDENT 2.0 .INDENT 3.5 Name of the node. .UNINDENT .UNINDENT .IP \(bu 2 Node .INDENT 2.0 .INDENT 3.5 Node information. When the formation has a single group (group zero), then this column only contains the nodeId. .sp 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 \fB0:1\fP for the first coordinator node. .UNINDENT .UNINDENT .IP \(bu 2 Host:Port .INDENT 2.0 .INDENT 3.5 Hostname and port number used to connect to the node. .UNINDENT .UNINDENT .IP \(bu 2 TLI: LSN .INDENT 2.0 .INDENT 3.5 Timeline identifier (TLI) and Postgres Log Sequence Number (LSN). .sp The LSN is the current position in the Postgres WAL stream. This is a hexadecimal number. See \fI\%pg_lsn\fP for more information. .sp The current \fI\%timeline\fP 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. .UNINDENT .UNINDENT .IP \(bu 2 Connection .INDENT 2.0 .INDENT 3.5 This output field contains two bits of information. First, the Postgres connection type that the node provides, either \fBread\-write\fP or \fBread\-only\fP\&. Then the mark \fB!\fP is added when the monitor has failed to connect to this node, and \fB?\fP when the monitor didn\(aqt connect to the node yet. .UNINDENT .UNINDENT .IP \(bu 2 Reported State .INDENT 2.0 .INDENT 3.5 The latest reported FSM state, as reported to the monitor by the pg_autoctl process running on the Postgres node. .UNINDENT .UNINDENT .IP \(bu 2 Assigned State .INDENT 2.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .UNINDENT .UNINDENT .UNINDENT .SH EXAMPLES .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pg_autoctl show state Name | Node | Host:Port | TLI: LSN | Connection | Reported State | Assigned State \-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- node1 | 1 | localhost:5501 | 1: 0/4000678 | read\-write | primary | primary node2 | 2 | localhost:5502 | 1: 0/4000678 | read\-only | secondary | secondary node3 | 3 | localhost:5503 | 1: 0/4000678 | read\-only | secondary | secondary $ pg_autoctl show state \-\-local Name | Node | Host:Port | TLI: LSN | Connection | Reported State | Assigned State \-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- node1 | 1 | localhost:5501 | 1: 0/4000678 | read\-write ? | primary | primary $ pg_autoctl show state \-\-json [ { "health": 1, "node_id": 1, "group_id": 0, "nodehost": "localhost", "nodename": "node1", "nodeport": 5501, "reported_lsn": "0/4000678", "reported_tli": 1, "formation_kind": "pgsql", "candidate_priority": 50, "replication_quorum": true, "current_group_state": "primary", "assigned_group_state": "primary" }, { "health": 1, "node_id": 2, "group_id": 0, "nodehost": "localhost", "nodename": "node2", "nodeport": 5502, "reported_lsn": "0/4000678", "reported_tli": 1, "formation_kind": "pgsql", "candidate_priority": 50, "replication_quorum": true, "current_group_state": "secondary", "assigned_group_state": "secondary" }, { "health": 1, "node_id": 3, "group_id": 0, "nodehost": "localhost", "nodename": "node3", "nodeport": 5503, "reported_lsn": "0/4000678", "reported_tli": 1, "formation_kind": "pgsql", "candidate_priority": 50, "replication_quorum": true, "current_group_state": "secondary", "assigned_group_state": "secondary" } ] .ft P .fi .UNINDENT .UNINDENT .SH AUTHOR Microsoft .SH COPYRIGHT Copyright (c) Microsoft Corporation. All rights reserved. .\" Generated by docutils manpage writer. .