1PG_AUTOCTL SHOW STATE(1) pg_auto_failover PG_AUTOCTL SHOW STATE(1)
2
3
4
6 pg_autoctl show state - pg_autoctl show state
7
8 pg_autoctl show state - Prints monitor's state of nodes in a given for‐
9 mation and group
10
12 This command outputs the current state of the formation and groups reg‐
13 istered to the pg_auto_failover monitor:
14
15 usage: pg_autoctl show state [ --pgdata --formation --group ]
16
17 --pgdata path to data directory
18 --monitor pg_auto_failover Monitor Postgres URL
19 --formation formation to query, defaults to 'default'
20 --group group to query formation, defaults to all
21 --local show local data, do not connect to the monitor
22 --watch display an auto-updating dashboard
23 --json output data in the JSON format
24
26 --pgdata
27 Location of the Postgres node being managed locally. Defaults to
28 the environment variable PGDATA. Use --monitor to connect to a
29 monitor from anywhere, rather than the monitor URI used by a lo‐
30 cal Postgres node managed with pg_autoctl.
31
32 --monitor
33 Postgres URI used to connect to the monitor. Must use the au‐
34 toctl_node username and target the pg_auto_failover database
35 name. It is possible to show the Postgres URI from the monitor
36 node using the command pg_autoctl show uri.
37
38 --formation
39 List the events recorded for nodes in the given formation. De‐
40 faults to default.
41
42 --group
43 Limit output to a single group in the formation. Default to in‐
44 cluding all groups registered in the target formation.
45
46 --local
47 Print the local state information without connecting to the mon‐
48 itor.
49
50 --watch
51 Take control of the terminal and display the current state of
52 the system and the last events from the monitor. The display is
53 updated automatically every 500 milliseconds (half a second) and
54 reacts properly to window size change.
55
56 Depending on the terminal window size, a different set of col‐
57 umns is visible in the state part of the output. See pg_autoctl
58 watch.
59
60 --json Output a JSON formated data instead of a table formatted list.
61
63 The pg_autoctl show state output includes the following columns:
64
65 • Name
66 Name of the node.
67
68 • Node
69 Node information. When the formation has a single group (group
70 zero), then this column only contains the nodeId.
71
72 Only Citus formations allow several groups. When using a Citus
73 formation the Node column contains the groupId and the nodeId,
74 separated by a colon, such as 0:1 for the first coordinator
75 node.
76
77 • Host:Port
78 Hostname and port number used to connect to the node.
79
80 • TLI: LSN
81 Timeline identifier (TLI) and Postgres Log Sequence Number
82 (LSN).
83
84 The LSN is the current position in the Postgres WAL stream.
85 This is a hexadecimal number. See pg_lsn for more information.
86
87 The current timeline is incremented each time a failover hap‐
88 pens, or when doing Point In Time Recovery. A node can only
89 reach the secondary state when it is on the same timeline as
90 its primary node.
91
92 • Connection
93 This output field contains two bits of information. First, the
94 Postgres connection type that the node provides, either
95 read-write or read-only. Then the mark ! is added when the
96 monitor has failed to connect to this node, and ? when the
97 monitor didn't connect to the node yet.
98
99 • Reported State
100 The latest reported FSM state, as reported to the monitor by
101 the pg_autoctl process running on the Postgres node.
102
103 • Assigned State
104 The assigned FSM state on the monitor. When the assigned state
105 is not the same as the reported start, then the pg_autoctl
106 process running on the Postgres node might have not retrieved
107 the assigned state yet, or might still be implementing the FSM
108 transition from the current state to the assigned state.
109
111 $ pg_autoctl show state
112 Name | Node | Host:Port | TLI: LSN | Connection | Reported State | Assigned State
113 ------+-------+----------------+----------------+--------------+---------------------+--------------------
114 node1 | 1 | localhost:5501 | 1: 0/4000678 | read-write | primary | primary
115 node2 | 2 | localhost:5502 | 1: 0/4000678 | read-only | secondary | secondary
116 node3 | 3 | localhost:5503 | 1: 0/4000678 | read-only | secondary | secondary
117
118 $ pg_autoctl show state --local
119 Name | Node | Host:Port | TLI: LSN | Connection | Reported State | Assigned State
120 ------+-------+----------------+----------------+--------------+---------------------+--------------------
121 node1 | 1 | localhost:5501 | 1: 0/4000678 | read-write ? | primary | primary
122
123 $ pg_autoctl show state --json
124 [
125 {
126 "health": 1,
127 "node_id": 1,
128 "group_id": 0,
129 "nodehost": "localhost",
130 "nodename": "node1",
131 "nodeport": 5501,
132 "reported_lsn": "0/4000678",
133 "reported_tli": 1,
134 "formation_kind": "pgsql",
135 "candidate_priority": 50,
136 "replication_quorum": true,
137 "current_group_state": "primary",
138 "assigned_group_state": "primary"
139 },
140 {
141 "health": 1,
142 "node_id": 2,
143 "group_id": 0,
144 "nodehost": "localhost",
145 "nodename": "node2",
146 "nodeport": 5502,
147 "reported_lsn": "0/4000678",
148 "reported_tli": 1,
149 "formation_kind": "pgsql",
150 "candidate_priority": 50,
151 "replication_quorum": true,
152 "current_group_state": "secondary",
153 "assigned_group_state": "secondary"
154 },
155 {
156 "health": 1,
157 "node_id": 3,
158 "group_id": 0,
159 "nodehost": "localhost",
160 "nodename": "node3",
161 "nodeport": 5503,
162 "reported_lsn": "0/4000678",
163 "reported_tli": 1,
164 "formation_kind": "pgsql",
165 "candidate_priority": 50,
166 "replication_quorum": true,
167 "current_group_state": "secondary",
168 "assigned_group_state": "secondary"
169 }
170 ]
171
173 Microsoft
174
176 Copyright (c) Microsoft Corporation. All rights reserved.
177
178
179
180
1811.6 Aug 04, 2022 PG_AUTOCTL SHOW STATE(1)