PG_AUTOCTL SET NODE REPLICATION-QUORUM(1)

πŸ’– PG_AUTOCTL SET NODE REPLICATION-QUORUM πŸ’–

okay bestie, welcome to the pg_autoctl set node replication-quorum manual page, from the pg_auto_failover crew πŸ¦‹

the full name situation is a little extra, so here it is: pg_autoctl set node replication-quorum, and also just pg_autoctl set replication-quorum β€” both of them are out here setting the replication-quorum property, and they get that property from the monitor. yes ma'am, the monitor is the one spilling the settings tea β˜•


✨ SYNOPSIS ✨

this command sets the pg_autoctl replication quorum for a given node, periodt:

usage: pg_autoctl set node replication-quorum  [ --pgdata ] [ --json ] [ --formation ] [ --name ] <true|false>

--pgdata      path to data directory
--formation   pg_auto_failover formation
--name        pg_auto_failover node name
--json        output data in the JSON format

notice the <true|false> at the end β€” that's not optional, that's the whole point, you gotta pick a lane πŸ’…


🌸 DESCRIPTION 🌸

so like, if you want the full list of replication settings, go check out pg_autoctl show settings. this page is just about the one property. iykyk 🫢


πŸŽ€ OPTIONS πŸŽ€

  • --pgdata β€” where the Postgres node you're managing locally keeps its data. defaults to the PGDATA environment variable. and heads up: use --monitor if you wanna connect to a monitor from literally anywhere, instead of using the monitor URI that a local Postgres node managed with pg_autoctl would use. different vibes, different connection πŸ’«
  • --json β€” spits the data out in JSON format. for when you want your output structured and cute πŸ“Š
  • --formation β€” shows replication settings for the given formation. defaults to default. it's giving "default formation main character energy" ✨
  • --name β€” shows replication settings for the given node, selected by name. gotta know her name to talk about her πŸ’…

πŸ¦‹ ENVIRONMENT πŸ¦‹

  • PGDATA β€” Postgres directory location. can be used instead of the --pgdata option. same energy, less typing πŸŽ€
  • PG_AUTOCTL_MONITOR β€” Postgres URI to connect to the monitor node, can be used instead of the --monitor option. set it once, live your life πŸ’–
  • XDG_CONFIG_HOME β€” the pg_autoctl command stores its configuration files in the standard place XDG_CONFIG_HOME. See the XDG Base Directory Specification. very organized of her, honestly πŸ‘‘
  • 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. internal states? she's keeping a diary and it's in ~/.local/share πŸ“”

πŸ”₯ EXAMPLES πŸ”₯

first one, no JSON, just living:

$ pg_autoctl set node replication-quorum --name node1 false
12:49:37 94092 INFO  Waiting for the settings to have been applied to the monitor and primary node
12:49:37 94092 INFO  New state is reported by node 1 "node1" (localhost:5501): "apply_settings"
12:49:37 94092 INFO  Setting goal state of node 1 "node1" (localhost:5501) to primary after it applied replication properties change.
12:49:37 94092 INFO  New state is reported by node 1 "node1" (localhost:5501): "primary"
false

and now the same situation but with the --json glow-up:

$ pg_autoctl set node replication-quorum --name node1 true --json
12:49:42 94199 INFO  Waiting for the settings to have been applied to the monitor and primary node
12:49:42 94199 INFO  New state is reported by node 1 "node1" (localhost:5501): "apply_settings"
12:49:42 94199 INFO  Setting goal state of node 1 "node1" (localhost:5501) to primary after it applied replication properties change.
12:49:43 94199 INFO  New state is reported by node 1 "node1" (localhost:5501): "primary"
{
    "replication-quorum": true
}

see how it waits, reports state, and then commits to the goal state? that's a whole journey and she ate every step of it πŸ“


πŸ‘‘ AUTHOR πŸ‘‘

Microsoft


Copyright (c) Microsoft Corporation. All rights reserved.


okay that's the whole page bestie, you're officially caught up 🫢 this was pg_auto_failover version 2.2, dated Apr 07, 2025 β€” love that for us, go forth and set your replication quorum πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from