PG_AUTOCTL PERFORM SWITCHOVER(1)
π PG_AUTOCTL PERFORM SWITCHOVER(1) π
okay bestie, pull up a chair because we're reading the pg_autoctl perform switchover manual page from pg_auto_failover, section 1 of the manual. yes it's a whole manual page for one command. yes it's iconic. let's get into it π
β¨ NAME β¨
pg_autoctl perform switchover β pg_autoctl perform switchover
pg_autoctl perform switchover β Perform a switchover for given formation and group
like. the name says it. it performs the switchover. no notes π
πΈ SYNOPSIS πΈ
so this command kicks off a Postgres switchover orchestration from the pg_auto_switchover monitor:
usage: pg_autoctl perform switchover [ --pgdata --formation --group ]
--pgdata path to data directory
--formation formation to target, defaults to 'default'
--group group to target, defaults to 0
look at her. so simple. so clean. β¨
π¦ DESCRIPTION π¦
the pg_auto_switchover monitor can be used to orchestrate a manual switchover, sometimes also known as a switchover (yes they said it twice, and honestly? correct of them).
when it does this, split-brain is prevented because of intermediary states being used in the Finite State Machine. so the FSM is the bodyguard here. π«Ά
the pg_autoctl perform switchover command waits until the switchover is known complete on the monitor, or until the hard-coded 60s timeout has passed. it's giving patient but not that patient.
and here's the thing, bestie: the switchover orchestration is done in the background by the monitor. so even if pg_autoctl perform switchover stops on the timeout, the switchover orchestration continues at the monitor. your command gave up, the monitor did not. main character energy fr fr. π
also see pg_autoctl perform failover, a synonym for this command. same vibe, different name.
π OPTIONS π
--pgdataβ location of the Postgres node being managed locally. defaults to the environment variablePGDATA. use--monitorto connect to a monitor from anywhere, rather than the monitor URI used by a local Postgres node managed withpg_autoctl.--formationβ formation to target for the operation. defaults todefault.--groupβ Postgres group to target for the operation. defaults to0, only Citus formations may have more than one group. (yes, only Citus. everyone else gets one group and they need to be okay with that.)
π ENVIRONMENT π
PGDATAβ Postgres directory location. Can be used instead of the--pgdataoption.PG_AUTOCTL_MONITORβ Postgres URI to connect to the monitor node, can be used instead of the--monitoroption.PG_CONFIGβ Can be set to the absolute path to thepg_configPostgres tool. This is mostly used in the context of building extensions, though it can be a useful way to select a Postgres version when several are installed on the same system.PATHβ Used the usual way mostly. Some entries that are searched in thePATHby thepg_autoctlcommand are expected to be found only once, to avoid mistakes with Postgres major versions.PGHOST,PGPORT,PGDATABASE,PGUSER,PGCONNECT_TIMEOUT, ... β See the Postgres docs about Environment Variables for details.TMPDIRβ Thepgcopydbcommand creates all its work files and directories in${TMPDIR}/pgcopydb, and defaults to/tmp/pgcopydb.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.
π AUTHOR π
Microsoft
π COPYRIGHT π
Copyright (c) Microsoft Corporation. All rights reserved.
and that's the whole page, bestie, no crumbs left. this was version 2.2, dated Apr 07, 2025 β written down here so you never have to squint at a manpage footer again. go switch something over. slay. πβ¨π¦πΈπ π«Ά
π¦ where this page comes from
- debian trixie: pg-auto-failover-cli 2.2-2 Β· PostgreSQL
- ubuntu questing: pg-auto-failover-cli 2.2-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms