.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "PG_AUTOCTL SHOW URI" "1" "Nov 06, 2022" "2.0" "pg_auto_failover" .SH NAME pg_autoctl show uri \- pg_autoctl show uri .sp pg_autoctl show uri \- Show the postgres uri to use to connect to pg_auto_failover nodes .SH SYNOPSIS .sp This command outputs the monitor or the coordinator Postgres URI to use from an application to connect to Postgres: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C usage: pg_autoctl show uri [ \-\-pgdata \-\-monitor \-\-formation \-\-json ] \-\-pgdata path to data directory \-\-monitor monitor uri \-\-formation show the coordinator uri of given formation \-\-json output data in the JSON format .ft P .fi .UNINDENT .UNINDENT .SH OPTIONS .INDENT 0.0 .TP .B \-\-pgdata Location of the Postgres node being managed locally. Defaults to the environment variable \fBPGDATA\fP\&. Use \fB\-\-monitor\fP to connect to a monitor from anywhere, rather than the monitor URI used by a local Postgres node managed with \fBpg_autoctl\fP\&. .TP .B \-\-monitor Postgres URI used to connect to the monitor. Must use the \fBautoctl_node\fP username and target the \fBpg_auto_failover\fP database name. It is possible to show the Postgres URI from the monitor node using the command \fI\%pg_autoctl show uri\fP\&. .sp Defaults to the value of the environment variable \fBPG_AUTOCTL_MONITOR\fP\&. .TP .B \-\-formation When \fB\-\-formation\fP is used, lists the Postgres URIs of all known formations on the monitor. .TP .B \-\-json Output a JSON formatted data instead of a table formatted list. .UNINDENT .SH ENVIRONMENT .sp PGDATA .INDENT 0.0 .INDENT 3.5 Postgres directory location. Can be used instead of the \fB\-\-pgdata\fP option. .UNINDENT .UNINDENT .sp PG_AUTOCTL_MONITOR .INDENT 0.0 .INDENT 3.5 Postgres URI to connect to the monitor node, can be used instead of the \fB\-\-monitor\fP option. .UNINDENT .UNINDENT .sp XDG_CONFIG_HOME .INDENT 0.0 .INDENT 3.5 The pg_autoctl command stores its configuration files in the standard place XDG_CONFIG_HOME. See the \fI\%XDG Base Directory Specification\fP\&. .UNINDENT .UNINDENT .sp XDG_DATA_HOME .INDENT 0.0 .INDENT 3.5 The pg_autoctl command stores its internal states files in the standard place XDG_DATA_HOME, which defaults to \fB~/.local/share\fP\&. See the \fI\%XDG Base Directory Specification\fP\&. .UNINDENT .UNINDENT .SH EXAMPLES .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pg_autoctl show uri Type | Name | Connection String \-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- monitor | monitor | postgres://autoctl_node@localhost:5500/pg_auto_failover formation | default | postgres://localhost:5502,localhost:5503,localhost:5501/demo?target_session_attrs=read\-write&sslmode=prefer $ pg_autoctl show uri \-\-formation monitor postgres://autoctl_node@localhost:5500/pg_auto_failover $ pg_autoctl show uri \-\-formation default postgres://localhost:5503,localhost:5502,localhost:5501/demo?target_session_attrs=read\-write&sslmode=prefer $ pg_autoctl show uri \-\-json [ { "uri": "postgres://autoctl_node@localhost:5500/pg_auto_failover", "name": "monitor", "type": "monitor" }, { "uri": "postgres://localhost:5503,localhost:5502,localhost:5501/demo?target_session_attrs=read\-write&sslmode=prefer", "name": "default", "type": "formation" } ] .ft P .fi .UNINDENT .UNINDENT .SH MULTI-HOSTS POSTGRES CONNECTION STRINGS .sp PostgreSQL since version 10 includes support for multiple hosts in its connection driver \fBlibpq\fP, with the special \fBtarget_session_attrs\fP connection property. .sp This multi\-hosts connection string facility allows applications to keep using the same stable connection string over server\-side failovers. That\(aqs why \fBpg_autoctl show uri\fP uses that format. .SH AUTHOR Microsoft .SH COPYRIGHT Copyright (c) Microsoft Corporation. All rights reserved. .\" Generated by docutils manpage writer. .