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

EXAMPLES

35          pg_autoctl show state
36           Name |  Node |      Host:Port |       LSN |   Connection |       Current State |      Assigned State
37          ------+-------+----------------+-----------+--------------+---------------------+--------------------
38          node1 |     1 | localhost:5501 | 0/4000760 |   read-write |             primary |             primary
39          node2 |     2 | localhost:5502 | 0/4000760 |    read-only |           secondary |           secondary
40          node3 |     3 | localhost:5503 | 0/4000760 |    read-only |           secondary |           secondary
41
42          $ pg_autoctl enable maintenance --pgdata node3
43          12:06:12 47086 INFO  Listening monitor notifications about state changes in formation "default" and group 0
44          12:06:12 47086 INFO  Following table displays times when notifications are received
45              Time |  Name |  Node |      Host:Port |       Current State |      Assigned State
46          ---------+-------+-------+----------------+---------------------+--------------------
47          12:06:12 | node1 |     1 | localhost:5501 |             primary |        join_primary
48          12:06:12 | node3 |     3 | localhost:5503 |           secondary |    wait_maintenance
49          12:06:12 | node3 |     3 | localhost:5503 |    wait_maintenance |    wait_maintenance
50          12:06:12 | node1 |     1 | localhost:5501 |        join_primary |        join_primary
51          12:06:12 | node3 |     3 | localhost:5503 |    wait_maintenance |         maintenance
52          12:06:12 | node1 |     1 | localhost:5501 |        join_primary |             primary
53          12:06:13 | node3 |     3 | localhost:5503 |         maintenance |         maintenance
54
55          $ pg_autoctl show state
56           Name |  Node |      Host:Port |       LSN |   Connection |       Current State |      Assigned State
57          ------+-------+----------------+-----------+--------------+---------------------+--------------------
58          node1 |     1 | localhost:5501 | 0/4000810 |   read-write |             primary |             primary
59          node2 |     2 | localhost:5502 | 0/4000810 |    read-only |           secondary |           secondary
60          node3 |     3 | localhost:5503 | 0/4000810 |         none |         maintenance |         maintenance
61

AUTHOR

63       Microsoft
64
66       Copyright (c) Microsoft Corporation. All rights reserved.
67
68
69
70
711.6                              Jan 21, 2022 PG_AUTOCTL ENABLE MAINTENANCE(1)
Impressum