Can I use .pgpass in logical replication?

From: JaeWon Lee <thejaewon(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Can I use .pgpass in logical replication?
Date: 2018-05-09 14:28:20
Message-ID: CAC+TV7EG_z6FKZOBPUUrXX1ZsJwt+HBkz9+Uh-OM3D37UCS+7w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi ^^ I'm using Logical replication. I made subscription like below.

=# CREATE SUBSCRIPTION mysub CONNECTION 'host=xxx.xxx.xxx.xxx port=5432
user=postgres dbname=mydb password=<password>' PUBLICATION mypub;
NOTICE: created replication slot "mysub" on publisher
CREATE SUBSCRIPTION

But I wonder if I can use .pgpass file to provide password. Of course, I
tried it. But it failed like below.

=# CREATE SUBSCRIPTION mysub CONNECTION 'host=xxx.xxx.xxx.xxx port=5432
user=postgres dbname=mydb' PUBLICATION mypub;
ERROR: could not connect to the publisher: fe_sendauth: no password
supplied

[My .pgpass]

localhost:5432:postgres:postgres:<password>
localhost:5432:mydb:postgres:<password>
xxx.xxx.xxx.xxx:5432:mydb:postgres:<password>

This .pgpass file works well for pgAgent.

Can I use .pgpass file for logical replication? or Should I write my
password in CREATE statement? If writing password in CREATE command is the
only answer, is it secure?

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message CONVERS Yann - DREAL Auvergne-Rhône-Alpes/CIDDAE/SIG 2018-05-09 14:48:34 Re: Can I use .pgpass in logical replication?
Previous Message David G. Johnston 2018-05-09 13:39:26 Re: How to rename current database?