PG_AUTOCTL_DISABLE_MAINTENANCE(1)
π PG_AUTOCTL DISABLE MAINTENANCE π
okay bestie, welcome to the pg_auto_failover corner of the manual β this one's all about pg_autoctl disable maintenance, aka the glow-up button that takes your node out of maintenance mode and back into the main character spotlight. π¦
β¨ NAME β¨
pg_autoctl disable maintenance β that's the whole thing, that's the command. It Disable Postgres maintenance mode on this node. periodt. π
πΈ SYNOPSIS πΈ
so a pg_auto_failover setup can be put into a maintenance state, right? and while a Postgres node is chillin' in that state, it's still registered to the monitor, and the monitor knows it's unreliable until maintenance gets disabled. and here's the important part, bestie β a node in maintenance state is not a candidate for promotion. not it. not today. π
the typical use case for maintenance state? operating system or Postgres reboots β like when you're applying security upgrades and you just need everybody to chill for a sec. π§
here's the usage line, copy it exactly:
usage: pg_autoctl disable maintenance [ --pgdata --allow-failover ]
--pgdata path to data directory
π OPTIONS π
--pgdataβ where the Postgres node you're managing locally actually lives. it defaults to the environment variablePGDATA. also β use--monitorto connect to a monitor from anywhere, rather than the monitor URI that a local Postgres node managed withpg_autoctlwould use. π«--formationβ the target formation where you wanna disable the secondary feature. tell it where to go, babe. π―
π¦ ENVIRONMENT π¦
PGDATAβ Postgres directory location. you can use this instead of the--pgdataoption. slay, less typing. β¨PG_AUTOCTL_MONITORβ Postgres URI to connect to the monitor node, and yeah you can use this 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 fun part, watch the whole journey. first, peep the state before:
$ 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 | none | maintenance | maintenance
see node3? sitting in maintenance, vibing, contributing nothing. iconic but useless. π
now we run the disable:
$ pg_autoctl disable maintenance --pgdata node3
12:06:37 47542 INFO Listening monitor notifications about state changes in formation "default" and group 0
12:06:37 47542 INFO Following table displays times when notifications are received
Time | Name | Node | Host:Port | Current State | Assigned State
---------+-------+-------+----------------+---------------------+--------------------
12:06:37 | node3 | 3 | localhost:5503 | maintenance | catchingup
12:06:37 | node3 | 3 | localhost:5503 | catchingup | catchingup
12:06:37 | node3 | 3 | localhost:5503 | catchingup | secondary
12:06:37 | node3 | 3 | localhost:5503 | secondary | secondary
look at that glow-up pipeline: maintenance β catchingup β catchingup β secondary. she's healing. she's thriving. we love a redemption arc. π
and the final state check:
$ pg_autoctl show state
Name | Node | Host:Port | LSN | Connection | Current State | Assigned State
------+-------+----------------+-----------+--------------+---------------------+--------------------
node1 | 1 | localhost:5501 | 0/4000848 | read-write | primary | primary
node2 | 2 | localhost:5502 | 0/4000848 | read-only | secondary | secondary
node3 | 3 | localhost:5503 | 0/4000000 | read-only | secondary | secondary
node3 is BACK, bestie. read-only, secondary, part of the team again. ate and left no crumbs. π
π AUTHOR π
Microsoft
π COPYRIGHT π
Copyright (c) Microsoft Corporation. All rights reserved.
lowkey reminder: a node in maintenance state is not a candidate for promotion and the monitor treats it as unreliable β so don't forget to disable it when you're done, fr fr. π
okay that's the whole page, sending you off with love from pg_auto_failover version 2.1, dated Jan 18, 2025. go disable some maintenance, you got this. mwah. π β¨π«Ά
π¦ 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