Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eECRo-00080B-PI for pgsql-admin@arkaria.postgresql.org; Mon, 13 Nov 2017 10:58:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eECRn-00019I-0G for pgsql-admin@arkaria.postgresql.org; Mon, 13 Nov 2017 10:58:35 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eECRl-00018c-RV for pgsql-admin@postgresql.org; Mon, 13 Nov 2017 10:58:34 +0000 Received: from mail-yw0-x234.google.com ([2607:f8b0:4002:c05::234]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eECRe-0002gh-7g for pgsql-admin@postgresql.org; Mon, 13 Nov 2017 10:58:32 +0000 Received: by mail-yw0-x234.google.com with SMTP id t11so13038007ywg.12 for ; Mon, 13 Nov 2017 02:58:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rAwGXw79dxFhal5mJTXXYkFnK+YV0VmyWni0pWAupkA=; b=SOIQVARU2ubfjvJa5y8bfskM8sNRiZ7OCyDhWl/K4nafZkHj02QxvhMxuYFtbQV5Tg WpFI7y0vs6+O7GABAmAr5q9OLDeDjLWm5+hw5zAjcJRBHLWlGf92R0PmEPqIVH0Gs4A7 bKYWkpDm0btP0wWKYvT4GZrBwJE/v0wKvs4d0MvFeLBDPdqMuG1ZGHSwly7efYBXlm4S l0Kg9uctN71KOeSJFa3j1hK+LyAz6gMUWwI+UJGiCuCsEQVIEpbzMlGAcMMGb0PuSDQS VaEjIPBSGzUr8fYLiur3el4fUceg7dQrkT2mRiXKeuH9k1kykIg6SR3AOdUDWOuFdw0j aFfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rAwGXw79dxFhal5mJTXXYkFnK+YV0VmyWni0pWAupkA=; b=B1vY8BZC369ZMJkcuYCRqcyPv+DjGU4qnHXOMV6bQK0muWbqNQOjV0/FtNn2OqwWKc v7wOliwl4A44B9vs1gBhZq/3PdzUJWtvO98Bk+dYDoJcrimjWddzBzxOpkoBNFez1f5u tyOaeQvOzTdFTSgW43IZjsJEF6MZzKC1/+oWsp/Vx5Pa96sZYGQJQDH4Ic0MHkuA+m7I VvLNCGZMtpu4bsaC6VPRguO9M7OiacxEOVSenpJGngcNS2xGJN6zfXETNMlnCxex2Fm8 5CY8+ZdEeHzc+dvdOC86JmbzVDenolaZmV1a9U8NdvfV5RQ9GMSnpzK3xnJqI5PJOtQz ONuw== X-Gm-Message-State: AJaThX7RxWwdqzw6zQQj53OviCdEITjnGga8vpY4oAJBgy1xi0UZYvGU umQsT1OQ48VVpMZnD2Ze+1t/L7RNRBUBdf7HbEM= X-Google-Smtp-Source: AGs4zMZCf8lUi7j9+01CyAxPQXyYlUpvZvCMKUtbs2I/OaIqzI3MZbpdm5Qj0G0MNVF9YRGPh2iVen9nPOMIXrz5J3k= X-Received: by 10.37.9.8 with SMTP id 8mr2747036ybj.370.1510570704738; Mon, 13 Nov 2017 02:58:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.111.69 with HTTP; Mon, 13 Nov 2017 02:58:24 -0800 (PST) In-Reply-To: References: From: Shreeyansh Dba Date: Mon, 13 Nov 2017 16:28:24 +0530 Message-ID: Subject: Re: FQDN for replication connection in pg_hba.conf To: "David G. Johnston" Cc: rammohan ganapavarapu , "pgsql-admin@postgresql.org" Content-Type: multipart/alternative; boundary="089e082c011c439e7f055ddb26e5" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org --089e082c011c439e7f055ddb26e5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 >> * trust >> >> >> I am getting below error in slave >> >> 2017-10-10 21:34:52 UTC [313]: [1-1] user=3D db=3D host=3D FATAL: could= not >> connect to the primary server: FATAL: no pg_hba.conf entry for replicat= ion >> connection from host "10.10.10.10", user "postgres", SSL off where >> "10.10.10.10" is my slave (*slave.example.com >> ) * ip. >> >> > =E2=80=8BThe comments and note under "address" at the following link sugg= est that > what you are trying is possible. Hopefully they can shed some light as t= o > what to check in order to find out why it is not working in your case.=E2= =80=8B In > particular, are both DNS entries configured? > > https://www.postgresql.org/docs/10/static/auth-pg-hba-conf.html > > =E2=80=8BEnsure you reload the configuration after making changes. > =E2=80=8B > =E2=80=8BI don't recall whether having a all/all/any entry above your rep= lication > 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 slave IP Address ii) pg_hba.conf # "local" is for Unix domain socket connections only host all all trust host all all trust # Allow replication connections from localhost, by a user with the # replication privilege. host replication postgres trust host replication postgres trust Note :- firewall must be disable on (master side) --=20 [image: http://www.shreeyansh.com] --089e082c011c439e7f055ddb26e5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, Oct 11, 2017 at 3:48 AM, David G. Johnston &l= t;david.g.j= ohnston@gmail.com> wrote:
On Tue, Oct 10, 2017 at 3:08 PM, rammohan ganapavarapu <rammohanganap@gmail.com> wrote:
C= an we use fqdn in =C2=A0pg_hba.conf for replication connections?


# TYPE =C2=A0DATABASE =C2=A0 =C2=A0 =C2=A0 =C2= =A0USER =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ADDRESS =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 METHOD

# &q= uot;local" is for Unix domain socket connections only
local = =C2=A0 all =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 all =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 trust
# IPv4 local connections= :
host =C2=A0 =C2=A0all =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= all =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0.0.0.0/0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0m= d5
host =C2=A0 =C2=A0 replication =C2=A0 =C2=A0 postgres =C2=A0 = =C2=A0 =C2=A0 sla= ve.example.com =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0trust
<= div>

I am getting below error in slave=C2=A0

2017-10-10 21:34:52 UTC [313]: [1-1] user=3D db=3D = host=3D FATAL: =C2=A0could not connect to the primary server: FATAL: =C2=A0= 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)=C2=A0=C2=A0ip.

=

=E2=80=8BThe comments and note under "address" at the follo= wing link suggest that what you are trying is possible.=C2=A0 Hopefully the= y can shed some light as to what to check in order to find out why it is no= t working in your case.=E2=80=8B=C2=A0 In particular, are both DNS entries = configured?


<= /div>
=E2=80=8BEn= sure you reload the configuration after making changes.
=E2=80=8B
=E2=80=8BI don't recall whether havin= g a all/all/any entry above your replication entry is going to be problemat= ic - but that wouldn't explain a "no pg_hba.conf entry" error= .

David J.

<= div>

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 postgre= sql and under /etc/hosts, that too both in master and slave

i) /etc/hosts (Entry = required for both master & slave)
maste= r IP address=C2=A0 =C2=A0 <name of the FQDN>=C2=A0 =C2=A0 =C2=A0 =C2= =A0<master hostname>
slave IP Address= =C2=A0 =C2=A0 =C2=A0 <name of the FQDN>=C2=A0 =C2=A0 <salve hostna= me>

ii) pg_hba.conf
# "local" is for= Unix domain socket connections only
host= =C2=A0 =C2=A0 all=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0all=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<name of the FQDN of master>= =C2=A0 =C2=A0 trust
host=C2=A0 =C2=A0 all= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0all=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0<name of the FQDN of slave>=C2=A0 trust
=

# Allow rep= lication connections from localhost, by a user with the
# replication privilege.
host= =C2=A0 =C2=A0 replication=C2=A0 =C2=A0 =C2=A0postgres=C2=A0 =C2=A0 =C2=A0 = =C2=A0 <name of the FQDN of master>=C2=A0 =C2=A0 =C2=A0trust
host=C2=A0 =C2=A0 replication=C2=A0 =C2=A0 =C2=A0po= stgres=C2=A0 =C2=A0 =C2=A0 =C2=A0 <name of the FQDN of slave>=C2=A0 t= rust

N= ote :- firewall must be disable on (master side)

--

3D"http://www.shreeyans=
<= /div>
--089e082c011c439e7f055ddb26e5--