Re: Question: Multiple pg clusters on one server can be reached with the standard port.

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Question: Multiple pg clusters on one server can be reached with the standard port.
Date: 2023-06-20 16:42:17
Message-ID: 20230620164217.rwdascyd52kgu774@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2023-06-20 10:10:47 -0500, Ron wrote:
> On 6/20/23 09:54, Peter J. Holzer wrote:
> > On 2023-06-19 16:09:34 -0500, Ron wrote:
> > > On 6/19/23 12:15, Peter J. Holzer wrote:
> > > On 2023-06-19 07:49:49 -0500, Ron wrote:
> > > On 6/19/23 05:33, Peter J. Holzer wrote:
> > > So (again, as Francisco already wrote) the best way is probably to write
> > > a simple proxy which uses the database (not DNS) name for routing. I
> > > seem to remember that nginx has a plugin architecture for protocols so
> > > it might make sense to write that as an nginx plugin instead of a
> > > standalone server, but that's really a judgement call the programmer has
> > > to make. Another possibility would of course be to extend pgbouncer to
> > > do what the OP needs.
> > >
> > > How would this work with JDBC clients?
> > >
> > > Same as with any other client, I guess. Any reason why it should be
> > > different?
> > >
> > >
> > > That goes to my ultimate point: why would this work, when the point of a
> > > database client is to connect to a database instance on a specific port like
> > > 5432, not connect to a web server.
> > Consider this scenario:
> >
> > You have several databases scattered across several hosts and ports:
> >
> > db1 host1.example.com:5432
> > db2 host1.example.com:5433
> > db3 host2.example.com:5432
> > db4 host3.example.com:5432
> >
> > Then you have your proxy/gateway/bouncer (whatever you want to call it)
> > listening on proxy.example.com:5432.
>
> Proxies/gateways are great. My question is about why you mentioned nginx.

Somebody else mentioned nginx as a possible solution. I wrote that I
don't think that nginx can do that out of the box but it might be
possible to write a plugin/module. Personally. I wouldn't (learning how
to write nginx modules almost certainly takes longer than writing a
simple proxy from scratch), but if somebody is already familiar with
nginx modules and/or has other reasons to use nginx ...

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Atul Kumar 2023-06-20 18:59:17 strange behavior of .pgpass file
Previous Message Ron 2023-06-20 15:10:47 Re: Question: Multiple pg clusters on one server can be reached with the standard port.