pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: database aliasing options ?
Date: Wed, 11 Nov 2020 15:33:23 +0100
Message-ID: <20201111143323.GA9849@hjp.at> (raw)
In-Reply-To: <1983183.1604936992@sss.pgh.pa.us>
References: <CAMBRECA2X01tECdC7BaFp35ECc1A1d8weg23HOvh2yQM2Hr9wg@mail.gmail.com>
	<1983183.1604936992@sss.pgh.pa.us>

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

view thread (3+ messages)

Message-ID: <20201111143323.GA9849@hjp.at>
Permalink:  ../20201111143323.GA9849@hjp.at/
Also on:    postgresql.org/message-id/20201111143323.GA9849@hjp.at

 · 

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: hjp-pgsql@hjp.at
  Subject: Re: database aliasing options ?
  In-Reply-To: <20201111143323.GA9849@hjp.at>
  References: <CAMBRECA2X01tECdC7BaFp35ECc1A1d8weg23HOvh2yQM2Hr9wg@mail.gmail.com> <1983183.1604936992@sss.pgh.pa.us> <20201111143323.GA9849@hjp.at>

* 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