PG_AUTOCTL DROP NODE(1) | pg_auto_failover | PG_AUTOCTL DROP NODE(1) |
pg_autoctl drop node - pg_autoctl drop node
pg_autoctl drop node - Drop a node from the pg_auto_failover monitor
This command drops a Postgres node from the pg_auto_failover monitor:
usage: pg_autoctl drop node [ [ [ --pgdata ] [ --destroy ] ] | [ --monitor [ [ --hostname --pgport ] | [ --formation --name ] ] ] ] --pgdata path to data directory --monitor pg_auto_failover Monitor Postgres URL --formation pg_auto_failover formation --name drop the node with the given node name --hostname drop the node with given hostname and pgport --pgport drop the node with given hostname and pgport --destroy also destroy Postgres database --force force dropping the node from the monitor --wait how many seconds to wait, default to 60
Two modes of operations are implemented in the pg_autoctl drop node command.
When removing a node that still exists, it is possible to use pg_autoctl drop node --destroy to remove the node both from the monitor and also delete the local Postgres instance entirely.
When removing a node that doesn't exist physically anymore, or when the VM that used to host the node has been lost entirely, use either the pair of options --hostname and --pgport or the pair of options --formation and --name to match the node registration record on the monitor database, and get it removed from the known list of nodes on the monitor.
Then option --force can be used when the target node to remove does not exist anymore. When a node has been lost entirely, it's not going to be able to finish the procedure itself, and it is then possible to instruct the monitor of the situation.
PGDATA
PG_AUTOCTL_MONITOR
PG_AUTOCTL_NODE_NAME
PG_AUTOCTL_REPLICATION_QUORUM
PG_AUTOCTL_CANDIDATE_PRIORITY
PG_CONFIG
PATH
PGHOST, PGPORT, PGDATABASE, PGUSER, PGCONNECT_TIMEOUT, ...
TMPDIR
XDG_CONFIG_HOME
XDG_DATA_HOME
$ pg_autoctl drop node --destroy --pgdata ./node3 17:52:21 54201 INFO Reaching assigned state "secondary" 17:52:21 54201 INFO Removing node with name "node3" in formation "default" from the monitor 17:52:21 54201 WARN Postgres is not running and we are in state secondary 17:52:21 54201 WARN Failed to update the keeper's state from the local PostgreSQL instance, see above for details. 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. 17:52:21 54201 INFO FSM transition to "dropped": This node is being dropped from the monitor 17:52:21 54201 INFO Transition complete: current state is now "dropped" 17:52:21 54201 INFO This node with id 4 in formation "default" and group 0 has been dropped from the monitor 17:52:21 54201 INFO Stopping PostgreSQL at "/Users/dim/dev/MS/pg_auto_failover/tmux/node3" 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 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] 17:52:21 54201 INFO pg_ctl: no server running 17:52:21 54201 INFO pg_ctl stop failed, but PostgreSQL is not running anyway 17:52:21 54201 INFO Removing "/Users/dim/dev/MS/pg_auto_failover/tmux/node3" 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"
Microsoft
Copyright (c) Microsoft Corporation. All rights reserved.
November 6, 2022 | 2.0 |