1PG_AUTOCTL PERFORM FAILOVER(1) pg_auto_failover PG_AUTOCTL PERFORM FAILOVER(1)
2
3
4

NAME

6       pg_autoctl perform failover - pg_autoctl perform failover
7
8       pg_autoctl  perform  failover  - Perform a failover for given formation
9       and group
10

SYNOPSIS

12       This  command  starts  a  Postgres  failover  orchestration  from   the
13       pg_auto_failover monitor:
14
15          usage: pg_autoctl perform failover  [ --pgdata --formation --group ]
16
17          --pgdata      path to data directory
18          --formation   formation to target, defaults to 'default'
19          --group       group to target, defaults to 0
20          --wait        how many seconds to wait, default to 60
21

DESCRIPTION

23       The  pg_auto_failover  monitor  can  be  used  to  orchestrate a manual
24       failover,  sometimes  also  known  as  a  switchover.  When  doing  so,
25       split-brain  are  prevented thanks to intermediary states being used in
26       the Finite State Machine.
27
28       The pg_autoctl perform failover command waits  until  the  failover  is
29       known  complete on the monitor, or until the hard-coded 60s timeout has
30       passed.
31
32       The failover orchestration is done in the background by the monitor, so
33       even  if  the  pg_autoctl  perform  failover  stops on the timeout, the
34       failover orchestration continues at the monitor.
35

OPTIONS

37       --pgdata
38              Location of the Postgres node being managed locally. Defaults to
39              the  environment  variable PGDATA. Use --monitor to connect to a
40              monitor from anywhere, rather than the monitor URI used by a lo‐
41              cal Postgres node managed with pg_autoctl.
42
43       --formation
44              Formation to target for the operation. Defaults to default.
45
46       --group
47              Postgres  group to target for the operation. Defaults to 0, only
48              Citus formations may have more than one group.
49
50       --wait How many seconds to wait for notifications about the  promotion.
51              The command stops when the promotion is finished (a node is pri‐
52              mary), or when the timeout has elapsed, whichever  comes  first.
53              The  value  0 (zero) disables the timeout and allows the command
54              to wait forever.
55

EXAMPLES

57          $ pg_autoctl perform failover
58          12:57:30 3635 INFO  Listening monitor notifications about state changes in formation "default" and group 0
59          12:57:30 3635 INFO  Following table displays times when notifications are received
60              Time |  Name |  Node |      Host:Port |       Current State |      Assigned State
61          ---------+-------+-------+----------------+---------------------+--------------------
62          12:57:30 | node1 |     1 | localhost:5501 |             primary |            draining
63          12:57:30 | node1 |     1 | localhost:5501 |            draining |            draining
64          12:57:30 | node2 |     2 | localhost:5502 |           secondary |          report_lsn
65          12:57:30 | node3 |     3 | localhost:5503 |           secondary |          report_lsn
66          12:57:36 | node3 |     3 | localhost:5503 |          report_lsn |          report_lsn
67          12:57:36 | node2 |     2 | localhost:5502 |          report_lsn |          report_lsn
68          12:57:36 | node2 |     2 | localhost:5502 |          report_lsn |   prepare_promotion
69          12:57:36 | node2 |     2 | localhost:5502 |   prepare_promotion |   prepare_promotion
70          12:57:36 | node2 |     2 | localhost:5502 |   prepare_promotion |    stop_replication
71          12:57:36 | node1 |     1 | localhost:5501 |            draining |      demote_timeout
72          12:57:36 | node3 |     3 | localhost:5503 |          report_lsn |      join_secondary
73          12:57:36 | node1 |     1 | localhost:5501 |      demote_timeout |      demote_timeout
74          12:57:36 | node3 |     3 | localhost:5503 |      join_secondary |      join_secondary
75          12:57:37 | node2 |     2 | localhost:5502 |    stop_replication |    stop_replication
76          12:57:37 | node2 |     2 | localhost:5502 |    stop_replication |        wait_primary
77          12:57:37 | node1 |     1 | localhost:5501 |      demote_timeout |             demoted
78          12:57:37 | node1 |     1 | localhost:5501 |             demoted |             demoted
79          12:57:37 | node2 |     2 | localhost:5502 |        wait_primary |        wait_primary
80          12:57:37 | node3 |     3 | localhost:5503 |      join_secondary |           secondary
81          12:57:37 | node1 |     1 | localhost:5501 |             demoted |          catchingup
82          12:57:38 | node3 |     3 | localhost:5503 |           secondary |           secondary
83          12:57:38 | node2 |     2 | localhost:5502 |        wait_primary |             primary
84          12:57:38 | node1 |     1 | localhost:5501 |          catchingup |          catchingup
85          12:57:38 | node2 |     2 | localhost:5502 |             primary |             primary
86
87          $ pg_autoctl show state
88           Name |  Node |      Host:Port |       LSN |   Connection |       Current State |      Assigned State
89          ------+-------+----------------+-----------+--------------+---------------------+--------------------
90          node1 |     1 | localhost:5501 | 0/4000F50 |    read-only |           secondary |           secondary
91          node2 |     2 | localhost:5502 | 0/4000F50 |   read-write |             primary |             primary
92          node3 |     3 | localhost:5503 | 0/4000F50 |    read-only |           secondary |           secondary
93

AUTHOR

95       Microsoft
96
98       Copyright (c) Microsoft Corporation. All rights reserved.
99
100
101
102
1031.6                              Aug 04, 2022   PG_AUTOCTL PERFORM FAILOVER(1)
Impressum