Re: strange behavior of .pgpass file

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Atul Kumar <akumar14871(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: strange behavior of .pgpass file
Date: 2023-06-21 08:40:50
Message-ID: 4354019843b27c9b88aa666398d438c4e2daf6ab.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2023-06-21 at 00:29 +0530, Atul Kumar wrote:
> I found some strange behaviour of postgres superuser password in my existing cluster, below is the basic outline of the setup.
> 1. version - postgres 12
> 2. replication - streaming replication async
> 3. OS- centos7
> 4. One Master, One Standby
>
> I have identical pgpass files on both server postgres home directory.
>
> So when I execute below command on slave node:
> psql -h slave_hostname/ip -U postgres -d postgres -p 5432 -c "select pg_is_in_recovery"
>
> I get error of password authentication:
>
> psql: error: FATAL:  password authentication failed for user "postgres"
> password retrieved from file "/homedirectorypath/.pgpass"
>
> But when I run the same command on master node:
> psql -h slave_hostname/ip -U postgres -d postgres -p 5432 -c "select pg_is_in_recovery"
>
> I don't get any errors and get the expected output as "t".
>
> Note: the passwords in and path of both pgpass files are identical.
>
> then why am I getting errors on the slave node for the same command even after having everything the same ?

pg_hba.conf could be different on both servers.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2023-06-21 09:00:38 libpq: What can and cannot be bound? How to know?
Previous Message Dominique Devienne 2023-06-21 07:48:29 Re: foreign keys on multiple parent table