pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feeddatabase aliasing options ?
3+ messages / 3 participants
[nested] [flat]
* database aliasing options ?
@ 2020-11-09 15:24 David Gauthier <davegauthierpg@gmail.com>
2020-11-09 15:49 ` Re: database aliasing options ? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: David Gauthier @ 2020-11-09 15:24 UTC (permalink / raw)
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Hi:
version 11.5 on linux.
Our IT dept has configured our PG DB as a "High Availability" database. It
has a primary and backup server (disks too). Normally both are running but
if one goes down, the other is still available for use, effectively keeping
the DB up while the failed server is being repaired.
My question has to do with creating and using a DB alias for DB connection
code. Of course the idea would be to toggle which server the alias is
pointing to based on the state of the servers. The idea is to manage which
server is being used OUTSIDE of the DB connection code by changing the
alias. The code always uses the alias.
Years ago, working for a different company, they had DB aliases, so I'm
assuming this is still possible (please tell if if it's not !). If this is
possible, where should I point our IT guys as far as instructions on how to
enable this or, if there are multiple options, what are a couple of the
simplest/best? Also, what options are there for the automated toggling of
which server the alias is pointing to if/when the one it's pointing to
comes down ?
Thanks for any replies !
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: database aliasing options ?
2020-11-09 15:24 database aliasing options ? David Gauthier <davegauthierpg@gmail.com>
@ 2020-11-09 15:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-11-11 14:33 ` Re: database aliasing options ? Peter J. Holzer <hjp-pgsql@hjp.at>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2020-11-09 15:49 UTC (permalink / raw)
To: David Gauthier <davegauthierpg@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
David Gauthier <davegauthierpg@gmail.com> writes:
> Our IT dept has configured our PG DB as a "High Availability" database. It
> has a primary and backup server (disks too). Normally both are running but
> if one goes down, the other is still available for use, effectively keeping
> the DB up while the failed server is being repaired.
> My question has to do with creating and using a DB alias for DB connection
> code. Of course the idea would be to toggle which server the alias is
> pointing to based on the state of the servers. The idea is to manage which
> server is being used OUTSIDE of the DB connection code by changing the
> alias. The code always uses the alias.
Some people do this by changing the DNS entry for the server.
Another thought is that maybe you don't have to do anything dynamic,
if you set up the clients with host lists not just single hostnames
(that is, "-h host1,host2" or the equivalent). That should work for
any libpq-based client.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: database aliasing options ?
2020-11-09 15:24 database aliasing options ? David Gauthier <davegauthierpg@gmail.com>
2020-11-09 15:49 ` Re: database aliasing options ? Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-11-11 14:33 ` Peter J. Holzer <hjp-pgsql@hjp.at>
0 siblings, 0 replies; 3+ messages in thread
From: Peter J. Holzer @ 2020-11-11 14:33 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 2020-11-09 10:49:52 -0500, Tom Lane wrote:
> David Gauthier <davegauthierpg@gmail.com> writes:
> > Our IT dept has configured our PG DB as a "High Availability" database. It
> > has a primary and backup server (disks too). Normally both are running but
> > if one goes down, the other is still available for use, effectively keeping
> > the DB up while the failed server is being repaired.
>
> > My question has to do with creating and using a DB alias for DB connection
> > code. Of course the idea would be to toggle which server the alias is
> > pointing to based on the state of the servers. The idea is to manage which
> > server is being used OUTSIDE of the DB connection code by changing the
> > alias. The code always uses the alias.
>
> Some people do this by changing the DNS entry for the server.
Another common method is to have a "floating" ip-address. That address
is always bound to the interface on the active node, so clients
can just connect to that address and don't need to care which node it
represents. Cluster resource managers like Pacemaker usually support
this. For Patroni there is a handy little tool called vip-manager.
Compared to DNS this has the advantage that latency is usually shorter.
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2020-11-11 14:33 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09 15:24 database aliasing options ? David Gauthier <davegauthierpg@gmail.com>
2020-11-09 15:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-11-11 14:33 ` Peter J. Holzer <hjp-pgsql@hjp.at>
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