Re: Feature: Use DNS SRV records for connecting

From: Graham Leggett <minfrin(at)sharp(dot)fm>
To: Feike Steenbergen <feikesteenbergen(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Feature: Use DNS SRV records for connecting
Date: 2019-08-13 10:21:37
Message-ID: 191719E9-6D3B-4E43-82F3-E7CC7871F173@sharp.fm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13 Aug 2019, at 11:50, Feike Steenbergen <feikesteenbergen(at)gmail(dot)com> wrote:

> I'd like to get some feedback on whether or not implementing a DNS SRV feature
> for connecting to PostgreSQL would be desirable/useful.

A big +1.

We currently use SRV records to tell postgresql what kind of server it is. This way all of our postgresql servers have an identical configuration, they just tailor themselves on startup as appropriate:

_postgresql-master._tcp.sql.example.com.

The above record in our case declares who the master is. If the postgresql startup says “hey, that’s me” it configures itself as a master. If the postgresql startup says “hey, that’s not me” it configures itself as a slave of the master.

We also use TXT records to define the databases we want (with protection against DNS security issues, we never remove a database based on a TXT record, but signed DNS records will help here).

_postgresql.sql.example.com TXT "v=PGSQL1;d=mydb;u=myuser"

We use a series of systemd “daemons” that are configured to run before and after postgresql to do the actual configuration on bootup, but it would be great if postgresql could just do this out the box.

Regards,
Graham

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-08-13 10:28:22 Re: POC: Cleaning up orphaned files using undo logs
Previous Message John Naylor 2019-08-13 10:09:30 Re: Bison state table