PG_AUTOCTL RUN(1)

πŸ’– PG_AUTOCTL RUN(1) πŸ’–

okay bestie, welcome to the pg_auto_failover manual, and specifically the glow-up that is pg_autoctl run. she's giving main character energy fr fr πŸŽ€


✨ NAME ✨

pg_autoctl run β€” pg_autoctl run

pg_autoctl run β€” Run the pg_autoctl service (monitor or keeper) πŸ‘‘


🌸 SYNOPSIS 🌸

so like, this command starts up all the processes you need to run a monitor node or a keeper node, and which one it is depends on the configuration file that belongs to the --pgdata option or the PGDATA environment variable. periodt.

usage: pg_autoctl run  [ --pgdata --name --hostname --pgport ]

--pgdata      path to data directory
--name        pg_auto_failover node name
--hostname    hostname used to connect from other nodes
--pgport      PostgreSQL's port number

πŸ¦‹ DESCRIPTION πŸ¦‹

When you register Postgres nodes to the pg_auto_failover monitor using the pg_autoctl create postgres command, the nodes get registered with metadata: the node name, hostname and Postgres port. it's giving ✨identity✨

The node name is used mostly in the logs and pg_autoctl show state commands, and it helps the human administrators of the formation keep track of who's who. no cap.

The node hostname and pgport are used by other nodes β€” including the pg_auto_failover monitor β€” to open a Postgres connection. like, that's how they find each other πŸ’…

Both the node name and the node hostname and port can be changed after the node registration, by using either this command (pg_autoctl run) or the pg_autoctl config set command. so you're not stuck with your first choices, we love that for you 🫢


πŸ’… OPTIONS πŸ’…

  • --pgdata β€” Where the Postgres node that's being managed locally lives. 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.
  • --name β€” Node name used on the monitor to refer to this node. The hostname is a technical information, and given Postgres requirements on the HBA setup and DNS resolution (both forward and reverse lookups), IP addresses are often used for the hostname.

The --name option allows using a user-friendly name for your Postgres nodes. cute AND functional πŸŽ€

  • --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. and bestie, she's a whole journey:

  1. We get this machine's "public IP" by opening a connection to the given monitor hostname or IP address. Then we get the TCP/IP client address that has been used to make that connection.
  2. We then do a reverse DNS lookup on the IP address found in the previous step to fetch a hostname for our local machine.
  3. If the reverse DNS lookup is successful , then pg_autoctl does 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. iconic behaviour honestly πŸ™ˆ

  • --pgport β€” Postgres port to use, defaults to 5432.

πŸ‘‘ AUTHOR πŸ‘‘

Microsoft


Copyright (c) Microsoft Corporation. All rights reserved.


πŸ’– okay that's the whole page bestie, go forth and run your nodes πŸ’–

and that's the vibe check, fr fr β€” this page is version 2.2, dated Apr 07, 2025, and it's the PG_AUTOCTL RUN(1) page from the pg_auto_failover manual. slay, you made it to the end πŸ¦‹βœ¨

πŸ“¦ where this page comes from