PG_AUTOCTL CREATE MONITOR(1)
π PG_AUTOCTL CREATE MONITOR(1) π
okay bestie, this is a page from pg_auto_failover, and today we're learning pg_autoctl create monitor. yes it's a lot of flags. no you're not gonna be normal about it. let's go π«Ά
β¨ NAME β¨
pg_autoctl create monitor β pg_autoctl create monitor
pg_autoctl create monitor β Initialize a pg_auto_failover monitor node πΈ
π SYNOPSIS π
This command initializes a PostgreSQL cluster and installs the pgautofailover extension so that it's possible to use the new instance to monitor PostgreSQL services:
usage: pg_autoctl create monitor [ --pgdata --pgport --pgctl --hostname ]
--pgctl path to pg_ctl
--pgdata path to data directory
--pgport PostgreSQL's port number
--hostname hostname by which postgres is reachable
--auth authentication method for connections from data nodes
--skip-pg-hba skip editing pg_hba.conf rules
--run create node then run pg_autoctl service
--ssl-self-signed setup network encryption using self signed certificates (does NOT protect against MITM)
--ssl-mode use that sslmode in connection strings
--ssl-ca-file set the Postgres ssl_ca_file to that file path
--ssl-crl-file set the Postgres ssl_crl_file to that file path
--no-ssl don't enable network encryption (NOT recommended, prefer --ssl-self-signed)
--server-key set the Postgres ssl_key_file to that file path
--server-cert set the Postgres ssl_cert_file to that file path
π¦ DESCRIPTION π¦
The pg_autoctl tool is the client tool provided by pg_auto_failover to create and manage Postgres nodes and the pg_auto_failover monitor node. The command is built with many sub-commands that each have their own manual page. like, one whole page per sub-command. they really said "documentation is self care" π
π OPTIONS π
The following options are available to pg_autoctl create monitor:
--pgctlβ Path to thepg_ctltool to use for the version of PostgreSQL you want to use.
Defaults to the pg_ctl found in the PATH when there is a single entry for pg_ctl in the PATH. Check your setup using which -a pg_ctl. π
When using an RPM based distribution such as RHEL or CentOS, the path would usually be /usr/pgsql-13/bin/pg_ctl for Postgres 13.
When using a debian based distribution such as debian or ubuntu, the path would usually be /usr/lib/postgresql/13/bin/pg_ctl for Postgres 13. Those distributions also use the package postgresql-common which provides /usr/bin/pg_config. This tool can be automatically used by pg_autoctl to discover the default version of Postgres to use on your setup. β¨
--pgdataβ Location where to initialize a Postgres database cluster, using eitherpg_ctl initdborpg_basebackup. Defaults to the environment variablePGDATA.--pgportβ Postgres port to use, defaults to5432.--hostnameβ Hostname or IP address (both v4 and v6 are supported) to use from any other node to connect to this node.
When not provided, a default value is computed by running the following algorithm. no cap, this is the whole bit:
- We get this machine's "public IP" by opening a connection to the
8.8.8.8:53public service. Then we get TCP/IP client address that has been used to make that connection. - We then do a reverse DNS lookup on the IP address found in the previous step to fetch a hostname for our local machine.
- If the reverse DNS lookup is successful , then
pg_autoctldoes a forward DNS lookup of that hostname.
When the forward DNS lookup response in step 3. is an IP address found in one of our local network interfaces, then pg_autoctl uses the hostname found in step 2. as the default --hostname. Otherwise it uses the IP address found in step 1.
You may use the --hostname command line option to bypass the whole DNS lookup based process and force the local node name to a fixed value. main character energy, honestly π
--authβ Authentication method used bypg_autoctlwhen editing the Postgres HBA file to open connections to other nodes. No default value, must be provided by the user. The value--trustis only a good choice for testing and evaluation of pg_auto_failover, see Security settings for pg_auto_failover for more information.
bestie. --trust is for vibes and testing only. do not ship it. π
--skip-pg-hbaβ When this option is used thenpg_autoctlrefrains from any editing of the Postgres HBA file. Please note that editing the HBA file is still needed so that other nodes can connect using either read privileges or replication streaming privileges.
When --skip-pg-hba is used, pg_autoctl still outputs the HBA entries it needs in the logs, it only skips editing the HBA file. π
--runβ Immediately run thepg_autoctlservice after having created this node.--ssl-self-signedβ Generate SSL self-signed certificates to provide network encryption. This does not protect against man-in-the-middle kinds of attacks. See Security settings for pg_auto_failover for more about our SSL settings.--ssl-modeβ SSL Mode used bypg_autoctlwhen connecting to other nodes, including when connecting for streaming replication.--ssl-ca-fileβ Set the Postgresssl_ca_fileto that file path.--ssl-crl-fileβ Set the Postgresssl_crl_fileto that file path.--no-sslβ Don't enable network encryption. This is not recommended, prefer--ssl-self-signed.--server-keyβ Set the Postgresssl_key_fileto that file path.--server-certβ Set the Postgresssl_cert_fileto that file path.
π ENVIRONMENT π
PGDATAPostgres directory location. Can be used instead of the--pgdataoption.PG_CONFIGCan be set to the absolute path to thepg_configPostgres tool. This is mostly used in the context of building extensions, though it can be a useful way to select a Postgres version when several are installed on the same system.PATHUsed the usual way mostly. Some entries that are searched in thePATHby thepg_autoctlcommand are expected to be found only once, to avoid mistakes with Postgres major versions. π¨PGHOST,PGPORT,PGDATABASE,PGUSER,PGCONNECT_TIMEOUT, ... See the Postgres docs about Environment Variables for details.TMPDIRThepgcopydbcommand creates all its work files and directories in${TMPDIR}/pgcopydb, and defaults to/tmp/pgcopydb.XDG_CONFIG_HOMEThepg_autoctlcommand stores its configuration files in the standard placeXDG_CONFIG_HOME. See the XDG Base Directory Specification.XDG_DATA_HOMEThepg_autoctlcommand stores its internal states files in the standard placeXDG_DATA_HOME, which defaults to~/.local/share. See the XDG Base Directory Specification.
π AUTHOR π
Microsoft
πΈ COPYRIGHT πΈ
Copyright (c) Microsoft Corporation. All rights reserved.
and that's the whole page, bestie β¨ this one's from version 2.2, dated Apr 07, 2025 β pg_autoctl create monitor(1), signing off, mwah π π
π¦ where this page comes from
- debian trixie: pg-auto-failover-cli 2.2-2 Β· PostgreSQL
- ubuntu questing: pg-auto-failover-cli 2.2-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms