PG_AUTOCTL_SET_NODE_CANDIDATE-PRIORITY(1)
β¨ NAME β¨
pg_autoctl set node candidate-priority β bestie, this is the glow-up button for your node's candidate-priority π
Also goes by pg_autoctl set candidate-priority β same energy, same job: set the candidate-priority property straight from the monitor, no cap.
This is part of the pg_auto_failover manual, page one of the pg_autoctl saga. π¦
πΈ SYNOPSIS πΈ
okay so, this command sets the pg_autoctl candidate priority for a given node:
usage: pg_autoctl set node candidate-priority [ --pgdata ] [ --json ] [ --formation ] [ --name ] <priority: 0..100>
--pgdata path to data directory
--formation pg_auto_failover formation
--name pg_auto_failover node name
--json output data in the JSON format
that <priority: 0..100> is a number, bestie β it's the whole point of the command. 0 to 100, nothing in between the vibes. π
π DESCRIPTION π
Also, go peek at pg_autoctl show settings β it's got the full list of replication settings, iykyk. That's where the whole menu lives. π
π OPTIONS π
--pgdataβ where the Postgres node that's being managed locally lives. It defaults to the environment variablePGDATA. And listen: you can use--monitorto connect to a monitor from literally anywhere, instead of the monitor URI that a local Postgres node managed withpg_autoctlis using. π«Ά--jsonβ output JSON formatted data. Structured, pretty, slay.--formationβ show replication settings for the given formation. Defaults todefault. (yes,defaultis the default, iconic behaviour honestly)--nameβ show replication settings for the given node, selected by name. Name that node, bestie. πΈ
π 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.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 β
Setting the priority to 65 on node1, live, with commentary:
$ pg_autoctl set node candidate-priority --name node1 65
12:47:59 92326 INFO Waiting for the settings to have been applied to the monitor and primary node
12:47:59 92326 INFO New state is reported by node 1 "node1" (localhost:5501): "apply_settings"
12:47:59 92326 INFO Setting goal state of node 1 "node1" (localhost:5501) to primary after it applied replication properties change.
12:47:59 92326 INFO New state is reported by node 1 "node1" (localhost:5501): "primary"
65
And now the same thing but with --json, because we love a structured moment:
$ pg_autoctl set node candidate-priority --name node1 50 --json
12:48:05 92450 INFO Waiting for the settings to have been applied to the monitor and primary node
12:48:05 92450 INFO New state is reported by node 1 "node1" (localhost:5501): "apply_settings"
12:48:05 92450 INFO Setting goal state of node 1 "node1" (localhost:5501) to primary after it applied replication properties change.
12:48:05 92450 INFO New state is reported by node 1 "node1" (localhost:5501): "primary"
{
"candidate-priority": 50
}
π¦ AUTHOR π¦
Microsoft
π COPYRIGHT π
Copyright (c) Microsoft Corporation. All rights reserved.
That's the whole page, bestie β version 2.1, dated Jan 18, 2025, and brought to you by the lovely humans at Microsoft. Go forth and set that priority. πβ¨
π¦ 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