PG_AUTOCTL_ENABLE_MONITOR(1)
π pg_autoctl enable monitor π
okay bestie, welcome to the pg_auto_failover manual, page PG_AUTOCTL_ENABLE_MONITOR(1). sit down, grab a strawberry π, we're talking about pg_autoctl enable monitor.
β¨ NAME β¨
pg_autoctl enable monitor β pg_autoctl enable monitor
pg_autoctl enable monitor β turn on a monitor for this node so it gets orchestrated from there. iconic behaviour tbh
π SYNOPSIS π
bestie, here's the tea: you can disable the pg_auto_failover monitor and then enable it again online in a running pg_autoctl Postgres node. no cap. the main use-cases where you'd wanna do this are when the monitor node has to be replaced β either after a full crash of the previous monitor node π, or for migrating to a new monitor node (hardware replacement, region or zone migration, etc). very main character energy for your infra.
usage: pg_autoctl enable monitor [ --pgdata --allow-failover ] postgres://autoctl_node@new.monitor.add.ress/pg_auto_failover
--pgdata path to data directory
πΈ OPTIONS πΈ
--pgdataβ where the Postgres node you're managing locally lives. defaults to the environment variablePGDATA. pro tip: use--monitorto connect to a monitor from anywhere, rather than the monitor URI that a local Postgres node managed withpg_autoctlis using. β¨
π¦ ENVIRONMENT π¦
PGDATAβ Postgres directory location. you can use this instead of the--pgdataoption. π«ΆPG_AUTOCTL_MONITORβ Postgres URI to connect to the monitor node, and you can use it instead of the--monitoroption.XDG_CONFIG_HOMEβ thepg_autoctlcommand stores its configuration files in the standard placeXDG_CONFIG_HOME. see the XDG Base Directory Specification. πXDG_DATA_HOMEβ thepg_autoctlcommand stores its internal states files in the standard placeXDG_DATA_HOME, which defaults to~/.local/share. see the XDG Base Directory Specification. πΎ
π§ EXAMPLES π§
okay this is the part where it gets real. watch the glow-up:
$ 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
$ pg_autoctl enable monitor --pgdata node3 'postgres://autoctl_node@localhost:5500/pg_auto_failover?sslmode=require'
12:42:07 43834 INFO Registered node 3 (localhost:5503) with name "node3" in formation "default", group 0, state "wait_standby"
12:42:07 43834 INFO Successfully registered to the monitor with nodeId 3
12:42:08 43834 INFO Still waiting for the monitor to drive us to state "catchingup"
12:42:08 43834 WARN Please make sure that the primary node is currently running `pg_autoctl run` and contacting the monitor.
$ pg_autoctl show state
Name | Node | Host:Port | LSN | Connection | Current State | Assigned State
------+-------+----------------+-----------+--------------+---------------------+--------------------
node1 | 1 | localhost:5501 | 0/4000810 | read-write | primary | primary
node2 | 2 | localhost:5502 | 0/4000810 | read-only | secondary | secondary
node3 | 3 | localhost:5503 | 0/4000810 | read-only | secondary | secondary
like?? node3 just showed up and slotted right in as a secondary. ate. π
thatWARNline is a real one tho β make sure the primary node is currently runningpg_autoctl runand contacting the monitor, or nothing's gonna drive you anywhere. no thoughts head empty is not a valid replication strategy bestie π
π AUTHOR π
Microsoft
π COPYRIGHT π
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, page PG_AUTOCTL_ENABLE_MONITOR(1) β go enable that monitor, you've got this. π¦β¨
π¦ where this page comes from
- fedora 43: pg_auto_failover 2.1-6.fc42 Β· Apache-1.0
- fedora 44: pg_auto_failover 2.1-6.fc42 Β· Apache-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms