1PG_AUTOCTL CREATE MONITOR(1) pg_auto_failover PG_AUTOCTL CREATE MONITOR(1)
2
3
4
6 pg_autoctl create monitor - pg_autoctl create monitor
7
8 pg_autoctl create monitor - Initialize a pg_auto_failover monitor node
9
11 This command initializes a PostgreSQL cluster and installs the pgauto‐
12 failover extension so that it's possible to use the new instance to
13 monitor PostgreSQL services:
14
15 usage: pg_autoctl create monitor [ --pgdata --pgport --pgctl --hostname ]
16
17 --pgctl path to pg_ctl
18 --pgdata path to data directory
19 --pgport PostgreSQL's port number
20 --hostname hostname by which postgres is reachable
21 --auth authentication method for connections from data nodes
22 --skip-pg-hba skip editing pg_hba.conf rules
23 --run create node then run pg_autoctl service
24 --ssl-self-signed setup network encryption using self signed certificates (does NOT protect against MITM)
25 --ssl-mode use that sslmode in connection strings
26 --ssl-ca-file set the Postgres ssl_ca_file to that file path
27 --ssl-crl-file set the Postgres ssl_crl_file to that file path
28 --no-ssl don't enable network encryption (NOT recommended, prefer --ssl-self-signed)
29 --server-key set the Postgres ssl_key_file to that file path
30 --server-cert set the Postgres ssl_cert_file to that file path
31
33 The pg_autoctl tool is the client tool provided by pg_auto_failover to
34 create and manage Postgres nodes and the pg_auto_failover monitor node.
35 The command is built with many sub-commands that each have their own
36 manual page.
37
39 The following options are available to pg_autoctl create monitor:
40
41 --pgctl
42 Path to the pg_ctl tool to use for the version of PostgreSQL you
43 want to use.
44
45 Defaults to the pg_ctl found in the PATH when there is a single
46 entry for pg_ctl in the PATH. Check your setup using which -a
47 pg_ctl.
48
49 When using an RPM based distribution such as RHEL or CentOS, the
50 path would usually be /usr/pgsql-13/bin/pg_ctl for Postgres 13.
51
52 When using a debian based distribution such as debian or ubuntu,
53 the path would usually be /usr/lib/postgresql/13/bin/pg_ctl for
54 Postgres 13. Those distributions also use the package post‐
55 gresql-common which provides /usr/bin/pg_config. This tool can
56 be automatically used by pg_autoctl to discover the default ver‐
57 sion of Postgres to use on your setup.
58
59 --pgdata
60 Location where to initialize a Postgres database cluster, using
61 either pg_ctl initdb or pg_basebackup. Defaults to the environ‐
62 ment variable PGDATA.
63
64 --pgport
65 Postgres port to use, defaults to 5432.
66
67 --hostname
68 Hostname or IP address (both v4 and v6 are supported) to use
69 from any other node to connect to this node.
70
71 When not provided, a default value is computed by running the
72 following algorithm.
73
74 1. We get this machine's "public IP" by opening a connection
75 to the 8.8.8.8:53 public service. Then we get TCP/IP
76 client address that has been used to make that connection.
77
78 2. We then do a reverse DNS lookup on the IP address found in
79 the previous step to fetch a hostname for our local ma‐
80 chine.
81
82 3. If the reverse DNS lookup is successful , then pg_autoctl
83 does a forward DNS lookup of that hostname.
84
85 When the forward DNS lookup response in step 3. is an IP address
86 found in one of our local network interfaces, then pg_autoctl
87 uses the hostname found in step 2. as the default --hostname.
88 Otherwise it uses the IP address found in step 1.
89
90 You may use the --hostname command line option to bypass the
91 whole DNS lookup based process and force the local node name to
92 a fixed value.
93
94 --auth Authentication method used by pg_autoctl when editing the Post‐
95 gres HBA file to open connections to other nodes. No default
96 value, must be provided by the user. The value --trust is only a
97 good choice for testing and evaluation of pg_auto_failover, see
98 Security settings for pg_auto_failover for more information.
99
100 --skip-pg-hba
101 When this option is used then pg_autoctl refrains from any edit‐
102 ing of the Postgres HBA file. Please note that editing the HBA
103 file is still needed so that other nodes can connect using ei‐
104 ther read privileges or replication streaming privileges.
105
106 When --skip-pg-hba is used, pg_autoctl still outputs the HBA en‐
107 tries it needs in the logs, it only skips editing the HBA file.
108
109 --run Immediately run the pg_autoctl service after having created this
110 node.
111
112 --ssl-self-signed
113 Generate SSL self-signed certificates to provide network encryp‐
114 tion. This does not protect against man-in-the-middle kinds of
115 attacks. See Security settings for pg_auto_failover for more
116 about our SSL settings.
117
118 --ssl-mode
119 SSL Mode used by pg_autoctl when connecting to other nodes, in‐
120 cluding when connecting for streaming replication.
121
122 --ssl-ca-file
123 Set the Postgres ssl_ca_file to that file path.
124
125 --ssl-crl-file
126 Set the Postgres ssl_crl_file to that file path.
127
128 --no-ssl
129 Don't enable network encryption. This is not recommended, prefer
130 --ssl-self-signed.
131
132 --server-key
133 Set the Postgres ssl_key_file to that file path.
134
135 --server-cert
136 Set the Postgres ssl_cert_file to that file path.
137
139 PGDATA
140 Postgres directory location. Can be used instead of the --pgdata op‐
141 tion.
142
143 PG_CONFIG
144 Can be set to the absolute path to the pg_config Postgres tool. This
145 is mostly used in the context of building extensions, though it can
146 be a useful way to select a Postgres version when several are in‐
147 stalled on the same system.
148
149 PATH
150 Used the usual way mostly. Some entries that are searched in the
151 PATH by the pg_autoctl command are expected to be found only once,
152 to avoid mistakes with Postgres major versions.
153
154 PGHOST, PGPORT, PGDATABASE, PGUSER, PGCONNECT_TIMEOUT, ...
155 See the Postgres docs about Environment Variables for details.
156
157 TMPDIR
158 The pgcopydb command creates all its work files and directories in
159 ${TMPDIR}/pgcopydb, and defaults to /tmp/pgcopydb.
160
161 XDG_CONFIG_HOME
162 The pg_autoctl command stores its configuration files in the stan‐
163 dard place XDG_CONFIG_HOME. See the XDG Base Directory Specifica‐
164 tion.
165
166 XDG_DATA_HOME
167 The pg_autoctl command stores its internal states files in the stan‐
168 dard place XDG_DATA_HOME, which defaults to ~/.local/share. See the
169 XDG Base Directory Specification.
170
172 Microsoft
173
175 Copyright (c) Microsoft Corporation. All rights reserved.
176
177
178
179
1802.0 Sep 13, 2023 PG_AUTOCTL CREATE MONITOR(1)