1PG_AUTOCTL SHOW URI(1)         pg_auto_failover         PG_AUTOCTL SHOW URI(1)
2
3
4

NAME

6       pg_autoctl show uri - pg_autoctl show uri
7
8       pg_autoctl  show  uri  -  Show  the  postgres  uri to use to connect to
9       pg_auto_failover nodes
10

SYNOPSIS

12       This command outputs the monitor or the coordinator Postgres URI to use
13       from an application to connect to Postgres:
14
15          usage: pg_autoctl show uri  [ --pgdata --monitor --formation --json ]
16
17            --pgdata      path to data directory
18            --monitor     monitor uri
19            --formation   show the coordinator uri of given formation
20            --json        output data in the JSON format
21

OPTIONS

23       --pgdata
24              Location of the Postgres node being managed locally. Defaults to
25              the environment variable PGDATA. Use --monitor to connect  to  a
26              monitor from anywhere, rather than the monitor URI used by a lo‐
27              cal Postgres node managed with pg_autoctl.
28
29       --monitor
30              Postgres URI used to connect to the monitor. Must  use  the  au‐
31              toctl_node  username  and  target  the pg_auto_failover database
32              name. It is possible to show the Postgres URI from  the  monitor
33              node using the command pg_autoctl show uri.
34
35              Defaults  to  the  value  of  the  environment  variable  PG_AU‐
36              TOCTL_MONITOR.
37
38       --formation
39              When --formation is used, lists the Postgres URIs of  all  known
40              formations on the monitor.
41
42       --json Output a JSON formated data instead of a table formatted list.
43

EXAMPLES

45          $ pg_autoctl show uri
46                  Type |    Name | Connection String
47          -------------+---------+-------------------------------
48               monitor | monitor | postgres://autoctl_node@localhost:5500/pg_auto_failover
49             formation | default | postgres://localhost:5502,localhost:5503,localhost:5501/demo?target_session_attrs=read-write&sslmode=prefer
50
51          $ pg_autoctl show uri --formation monitor
52          postgres://autoctl_node@localhost:5500/pg_auto_failover
53
54          $ pg_autoctl show uri --formation default
55          postgres://localhost:5503,localhost:5502,localhost:5501/demo?target_session_attrs=read-write&sslmode=prefer
56
57          $ pg_autoctl show uri --json
58          [
59           {
60               "uri": "postgres://autoctl_node@localhost:5500/pg_auto_failover",
61               "name": "monitor",
62               "type": "monitor"
63           },
64           {
65               "uri": "postgres://localhost:5503,localhost:5502,localhost:5501/demo?target_session_attrs=read-write&sslmode=prefer",
66               "name": "default",
67               "type": "formation"
68           }
69          ]
70

MULTI-HOSTS POSTGRES CONNECTION STRINGS

72       PostgreSQL  since version 10 includes support for multiple hosts in its
73       connection driver libpq, with the special target_session_attrs  connec‐
74       tion property.
75
76       This multi-hosts connection string facility allows applications to keep
77       using the same stable connection  string  over  server-side  failovers.
78       That's why pg_autoctl show uri uses that format.
79

AUTHOR

81       Microsoft
82
84       Copyright (c) Microsoft Corporation. All rights reserved.
85
86
87
88
891.6                              Nov 24, 2021           PG_AUTOCTL SHOW URI(1)
Impressum