1PG_AUTOCTL ENABLE MAINTENANCE(1)pg_auto_failoverPG_AUTOCTL ENABLE MAINTENANCE(1)
2
3
4

NAME

6       pg_autoctl enable maintenance - pg_autoctl enable maintenance
7
8       pg_autoctl  enable  maintenance  -  Enable Postgres maintenance mode on
9       this node
10

SYNOPSIS

12       A pg_auto_failover can be put to a maintenance state. The Postgres node
13       is  then still registered to the monitor, and is known to be unreliable
14       until maintenance is disabled. A node in the maintenance state is not a
15       candidate for promotion.
16
17       Typical  use of the maintenance state include Operating System or Post‐
18       gres reboot, e.g. when applying security upgrades.
19
20           usage: pg_autoctl enable maintenance  [ --pgdata --allow-failover ]
21
22          --pgdata      path to data directory
23

OPTIONS

25       --pgdata
26              Location of the Postgres node being managed locally. Defaults to
27              the  environment  variable PGDATA. Use --monitor to connect to a
28              monitor from anywhere, rather than the monitor URI used by a lo‐
29              cal Postgres node managed with pg_autoctl.
30
31       --formation
32              Target formation where to enable secondary feature.
33

ENVIRONMENT

35       PGDATA
36          Postgres directory location. Can be used instead of the --pgdata op‐
37          tion.
38
39       PG_AUTOCTL_MONITOR
40          Postgres URI to connect to the monitor node, can be used instead  of
41          the --monitor option.
42
43       XDG_CONFIG_HOME
44          The  pg_autoctl  command stores its configuration files in the stan‐
45          dard place XDG_CONFIG_HOME. See the XDG  Base  Directory  Specifica‐
46          tion.
47
48       XDG_DATA_HOME
49          The pg_autoctl command stores its internal states files in the stan‐
50          dard place XDG_DATA_HOME, which defaults to ~/.local/share. See  the
51          XDG Base Directory Specification.
52

EXAMPLES

54          pg_autoctl show state
55           Name |  Node |      Host:Port |       LSN |   Connection |       Current State |      Assigned State
56          ------+-------+----------------+-----------+--------------+---------------------+--------------------
57          node1 |     1 | localhost:5501 | 0/4000760 |   read-write |             primary |             primary
58          node2 |     2 | localhost:5502 | 0/4000760 |    read-only |           secondary |           secondary
59          node3 |     3 | localhost:5503 | 0/4000760 |    read-only |           secondary |           secondary
60
61          $ pg_autoctl enable maintenance --pgdata node3
62          12:06:12 47086 INFO  Listening monitor notifications about state changes in formation "default" and group 0
63          12:06:12 47086 INFO  Following table displays times when notifications are received
64              Time |  Name |  Node |      Host:Port |       Current State |      Assigned State
65          ---------+-------+-------+----------------+---------------------+--------------------
66          12:06:12 | node1 |     1 | localhost:5501 |             primary |        join_primary
67          12:06:12 | node3 |     3 | localhost:5503 |           secondary |    wait_maintenance
68          12:06:12 | node3 |     3 | localhost:5503 |    wait_maintenance |    wait_maintenance
69          12:06:12 | node1 |     1 | localhost:5501 |        join_primary |        join_primary
70          12:06:12 | node3 |     3 | localhost:5503 |    wait_maintenance |         maintenance
71          12:06:12 | node1 |     1 | localhost:5501 |        join_primary |             primary
72          12:06:13 | node3 |     3 | localhost:5503 |         maintenance |         maintenance
73
74          $ pg_autoctl show state
75           Name |  Node |      Host:Port |       LSN |   Connection |       Current State |      Assigned State
76          ------+-------+----------------+-----------+--------------+---------------------+--------------------
77          node1 |     1 | localhost:5501 | 0/4000810 |   read-write |             primary |             primary
78          node2 |     2 | localhost:5502 | 0/4000810 |    read-only |           secondary |           secondary
79          node3 |     3 | localhost:5503 | 0/4000810 |         none |         maintenance |         maintenance
80

AUTHOR

82       Microsoft
83
85       Copyright (c) Microsoft Corporation. All rights reserved.
86
87
88
89
902.0                              Sep 13, 2023 PG_AUTOCTL ENABLE MAINTENANCE(1)
Impressum