1PG_AUTOCTL ENABLE MONITOR(1) pg_auto_failover PG_AUTOCTL ENABLE MONITOR(1)
2
3
4
6 pg_autoctl enable monitor - pg_autoctl enable monitor
7
8 pg_autoctl enable monitor - Enable a monitor for this node to be or‐
9 chestrated from
10
12 It is possible to disable the pg_auto_failover monitor and enable it
13 again online in a running pg_autoctl Postgres node. The main use-cases
14 where this operation is useful is when the monitor node has to be re‐
15 placed, either after a full crash of the previous monitor node, of for
16 migrating to a new monitor node (hardware replacement, region or zone
17 migration, etc).
18
19 usage: pg_autoctl enable monitor [ --pgdata --allow-failover ] postgres://autoctl_node@new.monitor.add.ress/pg_auto_failover
20
21 --pgdata path to data directory
22
24 --pgdata
25 Location of the Postgres node being managed locally. Defaults to
26 the environment variable PGDATA. Use --monitor to connect to a
27 monitor from anywhere, rather than the monitor URI used by a lo‐
28 cal Postgres node managed with pg_autoctl.
29
31 $ pg_autoctl show state
32 Name | Node | Host:Port | LSN | Connection | Current State | Assigned State
33 ------+-------+----------------+-----------+--------------+---------------------+--------------------
34 node1 | 1 | localhost:5501 | 0/4000760 | read-write | primary | primary
35 node2 | 2 | localhost:5502 | 0/4000760 | read-only | secondary | secondary
36
37
38 $ pg_autoctl enable monitor --pgdata node3 'postgres://autoctl_node@localhost:5500/pg_auto_failover?sslmode=require'
39 12:42:07 43834 INFO Registered node 3 (localhost:5503) with name "node3" in formation "default", group 0, state "wait_standby"
40 12:42:07 43834 INFO Successfully registered to the monitor with nodeId 3
41 12:42:08 43834 INFO Still waiting for the monitor to drive us to state "catchingup"
42 12:42:08 43834 WARN Please make sure that the primary node is currently running `pg_autoctl run` and contacting the monitor.
43
44 $ pg_autoctl show state
45 Name | Node | Host:Port | LSN | Connection | Current State | Assigned State
46 ------+-------+----------------+-----------+--------------+---------------------+--------------------
47 node1 | 1 | localhost:5501 | 0/4000810 | read-write | primary | primary
48 node2 | 2 | localhost:5502 | 0/4000810 | read-only | secondary | secondary
49 node3 | 3 | localhost:5503 | 0/4000810 | read-only | secondary | secondary
50
52 Microsoft
53
55 Copyright (c) Microsoft Corporation. All rights reserved.
56
57
58
59
601.6 Jan 21, 2022 PG_AUTOCTL ENABLE MONITOR(1)