Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcrBm-0000jG-28 for pgsql-general@arkaria.postgresql.org; Wed, 11 Nov 2020 14:33:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kcrBk-0001DI-MI for pgsql-general@arkaria.postgresql.org; Wed, 11 Nov 2020 14:33:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcrBk-0001DB-Dy for pgsql-general@lists.postgresql.org; Wed, 11 Nov 2020 14:33:32 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcrBe-0003cG-PK for pgsql-general@lists.postgresql.org; Wed, 11 Nov 2020 14:33:31 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id F3E473D3E; Wed, 11 Nov 2020 15:33:23 +0100 (CET) Date: Wed, 11 Nov 2020 15:33:23 +0100 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: database aliasing options ? Message-ID: <20201111143323.GA9849@hjp.at> References: <1983183.1604936992@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5vNYLRcllDrimb99" Content-Disposition: inline In-Reply-To: <1983183.1604936992@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-11-09 10:49:52 -0500, Tom Lane wrote: > David Gauthier 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 kee= ping > > the DB up while the failed server is being repaired. >=20 > > My question has to do with creating and using a DB alias for DB connect= ion > > 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 w= hich > > server is being used OUTSIDE of the DB connection code by changing the > > alias. The code always uses the alias. >=20 > 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 --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --5vNYLRcllDrimb99 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAl+r9i8ACgkQ8g5IURL+ KF1lUw//ba2rlurZmR6ghRx5qHozsRIIruuzlTlNrILOF8q16xyttbeSW0DdBpMW 5+A2/uebx/T3/jboAEaOmx/3WtzI5lel7MFxZeOtSbJ0Va+uAIV+q50VTCYlF8ZC QLEw8YEwufEARyUxGfvhdHEh4U/kPOO0sGMB+dCwjc1QsNyfZ/tEbhfYWb29Y+CD P5mYRNkNQuW7ahlhJ1lJmvnQ0Eyjiniz9aRinJ1WV/NDRtSlj4pSe7ncBjQXo+Ct 09CeaCd9H21xcbxIt6/i2q1SGINyppFbXU7+KDJTij1mgJUucl2KhfUprMa4LZNp 79KDavNhR1GqfD1EBxKmFFgBd/5lPRKfFE98nIc/hNnwtD9RAogWCD0/yj8BYaFi JM8tDTKxz1Jk+WyqwCmdjPTAzWEWzjVKcFqHpQltfeuWPVhtr3tN5JmN3uzW4Ldz MDIe2hXpp4WLM+Qm7p2Lkg8Mg2RMH2imuSwtqxvHjIcB2RxyYvRfVMxw0MrVPhll vTC8VU5A5CajETUcnDJYGiCMOZW312rzYRXiqLe+Pz0bKCxZnhabRjFED+wgygzg 1zN8Bl/uTDNgCi4SoMkWKma0Ut8TVp3GF5k+URQjRZ353wDzmpQMbfe3EWofw6pw JNHzGcz8246dOV7KFP9zyYhl1Bzxzm13nI8N/8zE4ck7uL0tGkw= =NFZJ -----END PGP SIGNATURE----- --5vNYLRcllDrimb99--