PG_AUTOCTL CONFIG GET(1)

✨ PG_AUTOCTL CONFIG GET(1) ✨

okay bestie, welcome to pg_auto_failover's very own little lookup tool, aka pg_autoctl config get πŸ’–


🌸 NAME 🌸

pg_autoctl config get β€” pg_autoctl config get

pg_autoctl config get β€” literally just go grab the value of a given pg_autoctl configuration variable for you 🫢


πŸŽ€ SYNOPSIS πŸŽ€

This command prints a pg_autoctl configuration setting, no cap:

usage: pg_autoctl config get  [ --pgdata ] [ --json ] [ section.option ]

--pgdata      path to data directory

✨ OPTIONS ✨

  • --pgdata β€” where the Postgres node you're managing locally keeps its data directory. It defaults to the environment variable PGDATA. And heads up: if you wanna connect to a monitor from literally anywhere, use --monitor instead of the monitor URI that a local Postgres node managed with pg_autoctl is using. 🌈
  • --json β€” output the data all formatted as JSON. πŸ’…

πŸ¦‹ ENVIRONMENT πŸ¦‹

  • PGDATA β€” Postgres directory location. You can use this instead of the --pgdata option, fr fr.
  • 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. πŸ“

πŸ’œ DESCRIPTION πŸ’œ

So when you pass the argument section.option, that's the name of a configuration ooption (yes, that's how it's spelled in the source, iconic 😭). The configuration file for pg_autoctl is stored using the INI format.

When no argument is given to pg_autoctl config get, the entire configuration file shows up in the output. And if you're sitting there like "where is this config file even at??" β€” go look at pg_autoctl show file, specifically pg_autoctl show file --config. iykyk πŸ’…


🌟 EXAMPLES 🌟

With no arguments, we get the whole entire file:

$ pg_autoctl config get --pgdata node1
[pg_autoctl]
role = keeper
monitor = postgres://autoctl_node@localhost:5500/pg_auto_failover?sslmode=prefer
formation = default
group = 0
name = node1
hostname = localhost
nodekind = standalone

[postgresql]
pgdata = /Users/dim/dev/MS/pg_auto_failover/tmux/node1
pg_ctl = /Applications/Postgres.app/Contents/Versions/12/bin/pg_ctl
dbname = demo
host = /tmp
port = 5501
proxyport = 0
listen_addresses = *
auth_method = trust
hba_level = app

[ssl]
active = 1
sslmode = require
cert_file = /Users/dim/dev/MS/pg_auto_failover/tmux/node1/server.crt
key_file = /Users/dim/dev/MS/pg_auto_failover/tmux/node1/server.key

[replication]
maximum_backup_rate = 100M
backup_directory = /Users/dim/dev/MS/pg_auto_failover/tmux/backup/node_1

[timeout]
network_partition_timeout = 20
prepare_promotion_catchup = 30
prepare_promotion_walreceiver = 5
postgresql_restart_failure_timeout = 20
postgresql_restart_failure_max_retries = 3

You can also pipe the JSON formatted output straight into the jq command line and filter the result down to one specific section of the file. obsessed:

$ pg_autoctl config get --pgdata node1 --json | jq .pg_autoctl
{
  "role": "keeper",
  "monitor": "postgres://autoctl_node@localhost:5500/pg_auto_failover?sslmode=prefer",
  "formation": "default",
  "group": 0,
  "name": "node1",
  "hostname": "localhost",
  "nodekind": "standalone"
}

And finally, a single configuration element can be listed, just like that ✨:

$ pg_autoctl config get --pgdata node1 ssl.sslmode --json
require

πŸ‘‘ AUTHOR πŸ‘‘

Microsoft


Copyright (c) Microsoft Corporation. All rights reserved.


okay that's the whole page, you ate it πŸ’… this was pg_auto_failover version 2.2, dated Apr 07, 2025 β€” periodt, go get your config values bestie πŸŒˆπŸ¦‹πŸ’–

πŸ“¦ where this page comes from