PG_AUTOCTL_SET_NODE_CANDIDATE-PRIORITY(1)

πŸ“¦
version 2.1 Β· 2 versions
, in fedora 43, fedora 44

✨ 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 variable PGDATA. And listen: you can use --monitor to connect to a monitor from literally anywhere, instead of the monitor URI that a local Postgres node managed with pg_autoctl is using. 🫢
  • --json β€” output JSON formatted data. Structured, pretty, slay.
  • --formation β€” show replication settings for the given formation. Defaults to default. (yes, default is 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 --pgdata option. πŸŽ€
  • PG_AUTOCTL_MONITOR β€” Postgres URI to connect to the monitor node, can be used instead of the --monitor option.
  • XDG_CONFIG_HOME β€” the pg_autoctl command stores its configuration files in the standard place XDG_CONFIG_HOME. See the XDG Base Directory Specification.
  • XDG_DATA_HOME β€” the pg_autoctl command stores its internal states files in the standard place XDG_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 (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