From: Shreeyansh Dba <shreeyansh2014@gmail.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: rammohan ganapavarapu <rammohanganap@gmail.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: FQDN for replication connection in pg_hba.conf
Date: Mon, 13 Nov 2017 16:28:24 +0530
Message-ID: <CAGDYbUNUHbLc8sP28YFgG6nExtZKz+HKPcixNZXCEV3s6WbUhg@mail.gmail.com> (raw)
In-Reply-To: <CAKFQuwaG0hDigdJ0F6JNj+GcD6LePcLWoxSfq00JFAbzd4cwcg@mail.gmail.com>
References: <CALm_Vjif_fy2XU-K3nUdQoDoxrzmtHHUZj+=5cpOkcmwc2J8zA@mail.gmail.com>
<CAKFQuwaG0hDigdJ0F6JNj+GcD6LePcLWoxSfq00JFAbzd4cwcg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
On Wed, Oct 11, 2017 at 3:48 AM, David G. Johnston <
david.g.johnston@gmail.com> wrote:
> On Tue, Oct 10, 2017 at 3:08 PM, rammohan ganapavarapu <
> rammohanganap@gmail.com> wrote:
>
>> Can we use fqdn in pg_hba.conf for replication connections?
>>
>>
>> # TYPE DATABASE USER ADDRESS METHOD
>>
>> # "local" is for Unix domain socket connections only
>> local all all trust
>> # IPv4 local connections:
>> host all all 0.0.0.0/0 md5
>> host replication postgres *slave.example.com
>> <http://slave.example.com; * trust
>>
>>
>> I am getting below error in slave
>>
>> 2017-10-10 21:34:52 UTC [313]: [1-1] user= db= host= FATAL: could not
>> connect to the primary server: FATAL: no pg_hba.conf entry for replication
>> connection from host "10.10.10.10", user "postgres", SSL off where
>> "10.10.10.10" is my slave (*slave.example.com
>> <http://slave.example.com;) * ip.
>>
>>
> The comments and note under "address" at the following link suggest that
> what you are trying is possible. Hopefully they can shed some light as to
> what to check in order to find out why it is not working in your case. In
> particular, are both DNS entries configured?
>
> https://www.postgresql.org/docs/10/static/auth-pg-hba-conf.html
>
> Ensure you reload the configuration after making changes.
>
> I don't recall whether having a all/all/any entry above your replication
> entry is going to be problematic - but that wouldn't explain a "no
> pg_hba.conf entry" error.
>
> David J.
>
>
>
We can use fqdn in pg_hba.conf for replication connections
The only thing you need to do is mention the hostname both in pg_hba.conf
of postgresql and under /etc/hosts, that too both in master and slave
i) /etc/hosts (Entry required for both master & slave)
master IP address <name of the FQDN> <master hostname>
slave IP Address <name of the FQDN> <salve hostname>
ii) pg_hba.conf
# "local" is for Unix domain socket connections only
host all all <name of the FQDN of master>
trust
host all all <name of the FQDN of slave> trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication postgres <name of the FQDN of master>
trust
host replication postgres <name of the FQDN of slave> trust
Note :- firewall must be disable on (master side)
--
[image: http://www.shreeyansh.com] <http://www.shreeyansh.com;
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-admin@postgresql.org
Cc: shreeyansh2014@gmail.com, david.g.johnston@gmail.com, rammohanganap@gmail.com
Subject: Re: FQDN for replication connection in pg_hba.conf
In-Reply-To: <CAGDYbUNUHbLc8sP28YFgG6nExtZKz+HKPcixNZXCEV3s6WbUhg@mail.gmail.com>
References: <CALm_Vjif_fy2XU-K3nUdQoDoxrzmtHHUZj+=5cpOkcmwc2J8zA@mail.gmail.com> <CAKFQuwaG0hDigdJ0F6JNj+GcD6LePcLWoxSfq00JFAbzd4cwcg@mail.gmail.com> <CAGDYbUNUHbLc8sP28YFgG6nExtZKz+HKPcixNZXCEV3s6WbUhg@mail.gmail.com>
* 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