pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Carsten Klein <c.klein@datagis.com>
To: pgsql-general@lists.postgresql.org
Subject: Connect to specific cluster on command line
Date: Wed, 25 May 2022 16:30:06 +0200
Message-ID: <fb28c2b8-445c-0d9b-e12a-0fc827f6c1f8@datagis.com> (raw)

Hi there,

how can I connect to a specific cluster on the command line, e. g. with 
psql, pg_dump or pg_dumpall?

pg_lsclusters returns a list of all clusters available:

Ver Cluster Port [...]
14  main    5432 ...
14  test    5433  ...

I want to connect to or dump database xyz in the test cluster. Is it 
sufficient to specify the cluster's port only?

Perl script pg_backupcluster calls psql and pg_dump with a --cluster option:

pg_dump --cluster 14/test ...

However, this option is not documented (at least I didn't find anything) 
and also I didn't find anything in the sources on GitHub.

Actually, I only have the 14/main instance and cannot really test 
accessing the `test` cluster. However, psql and pg_dump actually work 
with --cluster 14/main and report an error when I specify 14/test so, 
the option --cluster seems to work. Is it intentionally not documented?

So, whats the recommended way to connect to a specific cluster? Is it 
just the port?

Regards, Carsten






view thread (9+ messages)  latest in thread

Message-ID: <fb28c2b8-445c-0d9b-e12a-0fc827f6c1f8@datagis.com>
Permalink:  ../fb28c2b8-445c-0d9b-e12a-0fc827f6c1f8@datagis.com/
Also on:    postgresql.org/message-id/fb28c2b8-445c-0d9b-e12a-0fc827f6c1f8@datagis.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: c.klein@datagis.com
  Subject: Re: Connect to specific cluster on command line
  In-Reply-To: <fb28c2b8-445c-0d9b-e12a-0fc827f6c1f8@datagis.com>
  References: <fb28c2b8-445c-0d9b-e12a-0fc827f6c1f8@datagis.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox