1PG_AUTOCTL SHOW STATE(1)       pg_auto_failover       PG_AUTOCTL SHOW STATE(1)
2
3
4

NAME

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

SYNOPSIS

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

OPTIONS

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 formatted data instead of a table formatted list.
61

ENVIRONMENT

63       PGDATA
64          Postgres directory location. Can be used instead of the --pgdata op‐
65          tion.
66
67       PG_AUTOCTL_MONITOR
68          Postgres URI to connect to the monitor node, can be used instead  of
69          the --monitor option.
70
71       XDG_CONFIG_HOME
72          The  pg_autoctl  command stores its configuration files in the stan‐
73          dard place XDG_CONFIG_HOME. See the XDG  Base  Directory  Specifica‐
74          tion.
75
76       XDG_DATA_HOME
77          The pg_autoctl command stores its internal states files in the stan‐
78          dard place XDG_DATA_HOME, which defaults to ~/.local/share. See  the
79          XDG Base Directory Specification.
80

DESCRIPTION

82       The pg_autoctl show state output includes the following columns:
83
84          • Name
85                Name of the node.
86
87          • Node
88                Node information. When the formation has a single group (group
89                zero), then this column only contains the nodeId.
90
91                Only Citus formations allow several groups. When using a Citus
92                formation the Node column contains the groupId and the nodeId,
93                separated by a colon, such as 0:1 for  the  first  coordinator
94                node.
95
96          • Host:Port
97                Hostname and port number used to connect to the node.
98
99          • TLI: LSN
100                Timeline  identifier  (TLI)  and  Postgres Log Sequence Number
101                (LSN).
102
103                The LSN is the current position in the  Postgres  WAL  stream.
104                This is a hexadecimal number. See pg_lsn for more information.
105
106                The  current timeline is incremented each time a failover hap‐
107                pens, or when doing Point In Time Recovery. A  node  can  only
108                reach  the  secondary state when it is on the same timeline as
109                its primary node.
110
111          • Connection
112                This output field contains two bits of information. First, the
113                Postgres  connection  type  that  the  node  provides,  either
114                read-write or read-only. Then the mark !  is  added  when  the
115                monitor  has  failed  to  connect to this node, and ? when the
116                monitor didn't connect to the node yet.
117
118          • Reported State
119                The latest reported FSM state, as reported to the  monitor  by
120                the pg_autoctl process running on the Postgres node.
121
122          • Assigned State
123                The assigned FSM state on the monitor. When the assigned state
124                is not the same as the reported  start,  then  the  pg_autoctl
125                process  running on the Postgres node might have not retrieved
126                the assigned state yet, or might still be implementing the FSM
127                transition from the current state to the assigned state.
128

EXAMPLES

130          $ pg_autoctl show state
131           Name |  Node |      Host:Port |       TLI: LSN |   Connection |      Reported State |      Assigned State
132          ------+-------+----------------+----------------+--------------+---------------------+--------------------
133          node1 |     1 | localhost:5501 |   1: 0/4000678 |   read-write |             primary |             primary
134          node2 |     2 | localhost:5502 |   1: 0/4000678 |    read-only |           secondary |           secondary
135          node3 |     3 | localhost:5503 |   1: 0/4000678 |    read-only |           secondary |           secondary
136
137          $ pg_autoctl show state --local
138           Name |  Node |      Host:Port |       TLI: LSN |   Connection |      Reported State |      Assigned State
139          ------+-------+----------------+----------------+--------------+---------------------+--------------------
140          node1 |     1 | localhost:5501 |   1: 0/4000678 | read-write ? |             primary |             primary
141
142          $ pg_autoctl show state --json
143          [
144              {
145                  "health": 1,
146                  "node_id": 1,
147                  "group_id": 0,
148                  "nodehost": "localhost",
149                  "nodename": "node1",
150                  "nodeport": 5501,
151                  "reported_lsn": "0/4000678",
152                  "reported_tli": 1,
153                  "formation_kind": "pgsql",
154                  "candidate_priority": 50,
155                  "replication_quorum": true,
156                  "current_group_state": "primary",
157                  "assigned_group_state": "primary"
158              },
159              {
160                  "health": 1,
161                  "node_id": 2,
162                  "group_id": 0,
163                  "nodehost": "localhost",
164                  "nodename": "node2",
165                  "nodeport": 5502,
166                  "reported_lsn": "0/4000678",
167                  "reported_tli": 1,
168                  "formation_kind": "pgsql",
169                  "candidate_priority": 50,
170                  "replication_quorum": true,
171                  "current_group_state": "secondary",
172                  "assigned_group_state": "secondary"
173              },
174              {
175                  "health": 1,
176                  "node_id": 3,
177                  "group_id": 0,
178                  "nodehost": "localhost",
179                  "nodename": "node3",
180                  "nodeport": 5503,
181                  "reported_lsn": "0/4000678",
182                  "reported_tli": 1,
183                  "formation_kind": "pgsql",
184                  "candidate_priority": 50,
185                  "replication_quorum": true,
186                  "current_group_state": "secondary",
187                  "assigned_group_state": "secondary"
188              }
189          ]
190

AUTHOR

192       Microsoft
193
195       Copyright (c) Microsoft Corporation. All rights reserved.
196
197
198
199
2002.0                              Sep 13, 2023         PG_AUTOCTL SHOW STATE(1)
Impressum