1PG_AUTOCTL DROP NODE(1)        pg_auto_failover        PG_AUTOCTL DROP NODE(1)
2
3
4

NAME

6       pg_autoctl drop node - pg_autoctl drop node
7
8       pg_autoctl drop node - Drop a node from the pg_auto_failover monitor
9

SYNOPSIS

11       This command drops a Postgres node from the pg_auto_failover monitor:
12
13          usage: pg_autoctl drop node [ [ [ --pgdata ] [ --destroy ] ] | [ --monitor [ [ --hostname --pgport ] | [ --formation --name ] ] ] ]
14
15          --pgdata      path to data directory
16          --monitor     pg_auto_failover Monitor Postgres URL
17          --formation   pg_auto_failover formation
18          --name        drop the node with the given node name
19          --hostname    drop the node with given hostname and pgport
20          --pgport      drop the node with given hostname and pgport
21          --destroy     also destroy Postgres database
22          --force       force dropping the node from the monitor
23          --wait        how many seconds to wait, default to 60
24

DESCRIPTION

26       Two  modes  of  operations  are implemented in the pg_autoctl drop node
27       command.
28
29       When removing a node that still exists, it is possible  to  use  pg_au‐
30       toctl  drop node --destroy to remove the node both from the monitor and
31       also delete the local Postgres instance entirely.
32
33       When removing a node that doesn't exist physically anymore, or when the
34       VM  that  used  to host the node has been lost entirely, use either the
35       pair of options --hostname and --pgport or the pair of options --forma‐
36       tion  and  --name  to match the node registration record on the monitor
37       database, and get it removed from the known list of nodes on the  moni‐
38       tor.
39
40       Then option --force can be used when the target node to remove does not
41       exist anymore. When a node has been lost entirely, it's not going to be
42       able  to  finish  the  procedure itself, and it is then possible to in‐
43       struct the monitor of the situation.
44

OPTIONS

46       --pgdata
47              Location of the Postgres node being managed locally. Defaults to
48              the  environment  variable PGDATA. Use --monitor to connect to a
49              monitor from anywhere, rather than the monitor URI used by a lo‐
50              cal Postgres node managed with pg_autoctl.
51
52       --monitor
53              Postgres  URI  used  to connect to the monitor. Must use the au‐
54              toctl_node username and  target  the  pg_auto_failover  database
55              name.  It  is possible to show the Postgres URI from the monitor
56              node using the command pg_autoctl show uri.
57
58       --hostname
59              Hostname of the Postgres node to remove from  the  monitor.  Use
60              either --name or --hostname --pgport, but not both.
61
62       --pgport
63              Port of the Postgres node to remove from the monitor. Use either
64              --name or --hostname --pgport, but not both.
65
66       --name Name of the node to remove from the monitor. Use  either  --name
67              or --hostname --pgport, but not both.
68
69       --destroy
70              By  default the pg_autoctl drop monitor commands does not remove
71              the Postgres database for the monitor. When using --destroy, the
72              Postgres installation is also deleted.
73
74       --force
75              By  default  a  node  is  expected  to  reach the assigned state
76              DROPPED when it is removed from the monitor, and has the  oppor‐
77              tunity  to  implement  clean-up actions. When the target node to
78              remove is not available anymore, it is possible to use  the  op‐
79              tion --force to immediately remove the node from the monitor.
80
81       --wait How  many  seconds  to wait for the node to be dropped entirely.
82              The command stops when the target node is not to be found on the
83              monitor  anymore,  or  when  the  timeout has elapsed, whichever
84              comes first. The value 0 (zero) disables the  timeout  and  dis‐
85              ables waiting entirely, making the command async.
86

ENVIRONMENT

88       PGDATA
89          Postgres directory location. Can be used instead of the --pgdata op‐
90          tion.
91
92       PG_AUTOCTL_MONITOR
93          Postgres URI to connect to the monitor node, can be used instead  of
94          the --monitor option.
95
96       PG_AUTOCTL_NODE_NAME
97          Node  name  to  register  to the monitor, can be used instead of the
98          --name option.
99
100       PG_AUTOCTL_REPLICATION_QUORUM
101          Can be used instead of the --replication-quorum option.
102
103       PG_AUTOCTL_CANDIDATE_PRIORITY
104          Can be used instead of the --candidate-priority option.
105
106       PG_CONFIG
107          Can be set to the absolute path to the pg_config Postgres tool. This
108          is  mostly used in the context of building extensions, though it can
109          be a useful way to select a Postgres version when  several  are  in‐
110          stalled on the same system.
111
112       PATH
113          Used  the  usual  way  mostly. Some entries that are searched in the
114          PATH by the pg_autoctl command are expected to be found  only  once,
115          to avoid mistakes with Postgres major versions.
116
117       PGHOST, PGPORT, PGDATABASE, PGUSER, PGCONNECT_TIMEOUT, ...
118          See the Postgres docs about Environment Variables for details.
119
120       TMPDIR
121          The  pgcopydb  command creates all its work files and directories in
122          ${TMPDIR}/pgcopydb, and defaults to /tmp/pgcopydb.
123
124       XDG_CONFIG_HOME
125          The pg_autoctl command stores its configuration files in  the  stan‐
126          dard  place  XDG_CONFIG_HOME.  See the XDG Base Directory Specifica‐
127          tion.
128
129       XDG_DATA_HOME
130          The pg_autoctl command stores its internal states files in the stan‐
131          dard  place XDG_DATA_HOME, which defaults to ~/.local/share. See the
132          XDG Base Directory Specification.
133

EXAMPLES

135          $ pg_autoctl drop node --destroy --pgdata ./node3
136          17:52:21 54201 INFO  Reaching assigned state "secondary"
137          17:52:21 54201 INFO  Removing node with name "node3" in formation "default" from the monitor
138          17:52:21 54201 WARN  Postgres is not running and we are in state secondary
139          17:52:21 54201 WARN  Failed to update the keeper's state from the local PostgreSQL instance, see above for details.
140          17:52:21 54201 INFO  Calling node_active for node default/4/0 with current state: PostgreSQL is running is false, sync_state is "", latest WAL LSN is 0/0.
141          17:52:21 54201 INFO  FSM transition to "dropped": This node is being dropped from the monitor
142          17:52:21 54201 INFO  Transition complete: current state is now "dropped"
143          17:52:21 54201 INFO  This node with id 4 in formation "default" and group 0 has been dropped from the monitor
144          17:52:21 54201 INFO  Stopping PostgreSQL at "/Users/dim/dev/MS/pg_auto_failover/tmux/node3"
145          17:52:21 54201 INFO  /Applications/Postgres.app/Contents/Versions/12/bin/pg_ctl --pgdata /Users/dim/dev/MS/pg_auto_failover/tmux/node3 --wait stop --mode fast
146          17:52:21 54201 INFO  /Applications/Postgres.app/Contents/Versions/12/bin/pg_ctl status -D /Users/dim/dev/MS/pg_auto_failover/tmux/node3 [3]
147          17:52:21 54201 INFO  pg_ctl: no server running
148          17:52:21 54201 INFO  pg_ctl stop failed, but PostgreSQL is not running anyway
149          17:52:21 54201 INFO  Removing "/Users/dim/dev/MS/pg_auto_failover/tmux/node3"
150          17:52:21 54201 INFO  Removing "/Users/dim/dev/MS/pg_auto_failover/tmux/config/pg_autoctl/Users/dim/dev/MS/pg_auto_failover/tmux/node3/pg_autoctl.cfg"
151

AUTHOR

153       Microsoft
154
156       Copyright (c) Microsoft Corporation. All rights reserved.
157
158
159
160
1612.0                              Sep 13, 2023          PG_AUTOCTL DROP NODE(1)
Impressum