PG_AUTOCTL_DISABLE_MONITOR(1)

πŸ“¦
version 2.1 Β· 2 versions
, in fedora 43, fedora 44

✨ NAME ✨

pg_autoctl disable monitor β€” bestie, this is the one that turns the monitor OFF for this node 🫢

It lives in the pg_auto_failover manual (section 1, obviously, she's a command), and the long-form name is literally just:

pg_autoctl disable monitor β€” Disable the monitor for this node


🌸 SYNOPSIS 🌸

okay so here's the tea: you can disable the pg_auto_failover monitor and then enable it again online, on a running pg_autoctl Postgres node. no downtime era. πŸ’…

The main use-cases where this is the move:

  • the monitor node has to be replaced
  • after a full crash of the previous monitor node
  • migrating to a new monitor node (hardware replacement, region or zone migration, etc.)

Here's the usage line, verbatim, no cap:

usage: pg_autoctl disable monitor  [ --pgdata --force ]

--pgdata      path to data directory
--force       force unregistering from the monitor

πŸ‘‘ OPTIONS πŸ‘‘

  • --pgdata β€” where the Postgres node that's being managed locally lives. Defaults to the environment variable PGDATA. Also, heads up: use --monitor to connect to a monitor from anywhere, instead of the monitor URI used by a local Postgres node managed with pg_autoctl.
  • --force β€” okay so --force is covering TWO whole situations, and she's doing the most:
    1. By default, the command expects to be able to connect to the current monitor. When the current known monitor in the setup is not running anymore, use --force to skip this step. ✨
    2. When pg_autoctl could connect to the monitor and the node is found there, this is normally an error that prevents from disabling the monitor. Using --force allows the command to drop the node from the monitor and continue with disabling the monitor.

🌈 ENVIRONMENT 🌈

  • PGDATA β€” Postgres directory location. Can be used instead of the --pgdata option.
  • PG_AUTOCTL_MONITOR β€” Postgres URI to connect to the monitor node, can be used instead of the --monitor option.
  • XDG_CONFIG_HOME β€” The pg_autoctl command stores its configuration files in the standard place XDG_CONFIG_HOME. See the XDG Base Directory Specification.
  • XDG_DATA_HOME β€” The pg_autoctl command stores its internal states files in the standard place XDG_DATA_HOME, which defaults to ~/.local/share. See the XDG Base Directory Specification.

πŸ¦‹ EXAMPLES πŸ¦‹

the whole glow-up, start to finish. first, a vibe check on the cluster:

$ pg_autoctl show state
    Name |  Node |      Host:Port |       LSN |   Connection |       Current State |      Assigned State
------+-------+----------------+-----------+--------------+---------------------+--------------------
node1 |     1 | localhost:5501 | 0/4000148 |   read-write |             primary |             primary
node2 |     2 | localhost:5502 | 0/4000148 |    read-only |           secondary |           secondary
node3 |     3 | localhost:5503 | 0/4000148 |    read-only |           secondary |           secondary

then we try to disable the monitor on node3 with no --force… and she said no 😭:

$ pg_autoctl disable monitor --pgdata node3
12:41:21 43039 INFO  Found node 3 "node3" (localhost:5503) on the monitor
12:41:21 43039 FATAL Use --force to remove the node from the monitor

okay fine, --force it is, slay πŸ’…:

$ pg_autoctl disable monitor --pgdata node3 --force
12:41:32 43219 INFO  Removing node 3 "node3" (localhost:5503) from monitor

and boom, node3 has left the chat:

$ pg_autoctl show state
 Name |  Node |      Host:Port |       LSN |   Connection |       Current State |      Assigned State
------+-------+----------------+-----------+--------------+---------------------+--------------------
node1 |     1 | localhost:5501 | 0/4000760 |   read-write |             primary |             primary
node2 |     2 | localhost:5502 | 0/4000760 |    read-only |           secondary |           secondary

πŸŽ€ AUTHOR πŸŽ€

Microsoft πŸ‘‘


Copyright (c) Microsoft Corporation. All rights reserved.


and that's the whole page, bestie!! 🌈✨

this was pg_auto_failover, version 2.1, dated Jan 18, 2025, and it's page PG_AUTOCTL DISABLE MONITOR(1) of the manual. mwah. πŸ’…πŸ’–πŸ¦‹

πŸ“¦ where this page comes from