PG_AUTOCTL_PERFORM_SWITCHOVER(1)
π pg_autoctl perform switchover π
okay bestie, so this one lives in the pg_auto_failover manual section, and it's literally called pg_autoctl perform switchover. Two descriptions, same vibe, no cap:
pg_autoctl perform switchoverβ pg_autoctl perform switchoverpg_autoctl perform switchoverβ Perform a switchover for given formation and group
so like. it does the switchover thing. for a formation. and a group. periodt β¨
πΈ SYNOPSIS πΈ
this command starts a Postgres switchover orchestration from the pg_auto_switchover monitor, and the usage is giving:
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
π¦ DESCRIPTION π¦
so the pg_auto_switchover monitor can orchestrate a manual switchover β sometimes also known as a switchover, yes they said it twice, iconic of them π β and when it does, split-brain is prevented because the Finite State Machine uses intermediary states. it's giving safe. it's giving responsible. we love a state machine that protects us π«Ά
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. so worst case you're standing there for a minute, not forever π
and here's the cute part: 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 honestly π
also go look at pg_autoctl perform failover, it's a synonym for this command. same energy, different name, iykyk β¨
β¨ OPTIONS β¨
--pgdataβ where the Postgres node being managed locally lives. defaults to the environment variablePGDATA. and hiiii, use--monitorif you wanna connect to a monitor from anywhere, instead of the monitor URI that a local Postgres node managed withpg_autoctlis using π--formationβ the formation you're targeting for the operation. defaults todefault. it's always default bestie π--groupβ the Postgres group you're targeting for the operation. defaults to0, and only Citus formations may have more than one group. so if you're not on Citus, it's group 0 and that's that π
π ENVIRONMENT π
PGDATAβ Postgres directory location. can be used instead of the--pgdataoption. same thing, different outfit π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 also be a genuinely useful way to select a Postgres version when several are installed on the same system. lowkey a lifesaver when you've got like four Postgres versions fighting on one machine πPATHβ used the usual way, mostly. some entries that thepg_autoctlcommand searches in thePATHare expected to be found only once, to avoid mistakes with Postgres major versions. so don't be messy with yourPATH, bestie, that's how you end up with the wrong major version and a bad time πPGHOST,PGPORT,PGDATABASE,PGUSER,PGCONNECT_TIMEOUT, ... β see the Postgres docs about Environment Variables for details. go read them, they're thorough πTMPDIRβ thepgcopydbcommand creates all its work files and directories in${TMPDIR}/pgcopydb, and defaults to/tmp/pgcopydb. yes it says pgcopydb, that's what the original says, we don't question it πXDG_CONFIG_HOMEβ thepg_autoctlcommand stores its configuration files in the standard placeXDG_CONFIG_HOME. see the XDG Base Directory Specification. organized queen behavior β¨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. internal states, tucked away neatly, we stan a tidy filesystem π
π AUTHOR π
Microsoft π«Ά
π COPYRIGHT π
Copyright (c) Microsoft Corporation. All rights reserved.
and that's the whole page, bestie!! this was version 2.1, dated Jan 18, 2025, from the pg_auto_failover manual. now go switch something over, safely, with your FSM protecting you the whole time πβ¨π¦π
π¦ 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