1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
.. _pg_autoctl_config_get:
pg_autoctl config get
=====================
pg_autoctl config get - Get the value of a given pg_autoctl configuration variable
Synopsis
--------
This command prints a ``pg_autoctl`` configuration setting::
usage: pg_autoctl config get [ --pgdata ] [ --json ] [ section.option ]
--pgdata path to data directory
Options
-------
--pgdata
Location of the Postgres node being managed locally. Defaults to the
environment variable ``PGDATA``. Use ``--monitor`` to connect to a monitor
from anywhere, rather than the monitor URI used by a local Postgres node
managed with ``pg_autoctl``.
--json
Output JSON formatted data.
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`__.
__ https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
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`__.
__ https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Description
-----------
When the argument ``section.option`` is used, this is the name of a
configuration ooption. 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 is given in the output. To figure out where the
configuration file is stored, see :ref:`pg_autoctl_show_file` and use
``pg_autoctl show file --config``.
Examples
--------
Without arguments, we get the 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
It is possible to pipe JSON formatted output to the ``jq`` command line and
filter the result down to a specific section of the file::
$ 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"
}
Finally, a single configuration element can be listed::
$ pg_autoctl config get --pgdata node1 ssl.sslmode --json
require
|