pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to make PAF use psql to login with password
2+ messages / 2 participants
[nested] [flat]

* How to make PAF use psql to login with password
@ 2019-03-06 01:57  范国腾 <fanguoteng@highgo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: 范国腾 @ 2019-03-06 01:57 UTC (permalink / raw)
  To: pgsql-general; users@clusterlabs.org <users@clusterlabs.org>; +Cc: 祁华鹏 <qihuapeng@highgo.com>

Hi,

We use the PAF (https://dalibo.github.io/PAF/?) to manage the postgresql.


According to user's requirement, we could not use trust mode in the pg_hba.conf? file. So when running psql, it will ask us to input the password and we have to input the password manually.


So the pcs status show the following error:

* pgsqld_stop_0 on node1-pri 'unknown error' (1): call=34, status=complete, exitreason='Unexpected state for instance "pgsqld" (returned 1)',
    last-rc-change='Wed Mar  6 09:09:46 2019', queued=0ms, exec=504ms



The cause of the error is that the PAF (/usr/lib/ocf/resource.d/heartbeat/pgsqlms)  will ask to input the password and we could not pass the password to psql command in the PAF script.


        exec $PGPSQL, '--set', 'ON_ERROR_STOP=1', '-qXAtf', $tmpfile,
    '-R', $RS, '-F', $FS, '--port', $pgport, '--host', $pghost,'--username','sysdba',

Is there any way for us to pass the password to the psql command in the PAF script?

We have tried to add the "export PGPASSWORD=123456" in the /etc/profile and it does not work.

thanks








^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: How to make PAF use psql to login with password
@ 2019-03-06 05:06  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: 范国腾 <fanguoteng@highgo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Adrian Klaver @ 2019-03-06 05:06 UTC (permalink / raw)
  To: 范国腾 <fanguoteng@highgo.com>; pgsql-general; users@clusterlabs.org <users@clusterlabs.org>; +Cc: 祁华鹏 <qihuapeng@highgo.com>

On 3/5/19 5:57 PM, 范国腾 wrote:
> Hi,
> 
> We use the PAF (https://dalibo.github.io/PAF/​) to manage the postgresql.
> 
> 
> According to user's requirement, we could not use trust mode in the 
> pg_hba.conf​ file. So when running psql, it will ask us to input the 
> password and we have to input the password manually.
> 
> 
> So the pcs status show the following error:
> 
> * pgsqld_stop_0 on node1-pri 'unknown error' (1): call=34, 
> status=complete, exitreason='Unexpected state for instance "pgsqld" 
> (returned 1)',
>      last-rc-change='Wed Mar  6 09:09:46 2019', queued=0ms, exec=504ms
> 
> 
> 
> The cause of the error is that the PAF 
> (/usr/lib/ocf/resource.d/heartbeat/pgsqlms)  will ask to input the 
> password and we could not pass the password to psql command in the PAF 
> script.
> 
> 
>          exec $PGPSQL, '--set', 'ON_ERROR_STOP=1', '-qXAtf', $tmpfile,
>      '-R', $RS, '-F', $FS, '--port', $pgport, '--host', 
> $pghost,'--username','sysdba',
> 
> Is there any way for us to pass the password to the psql command in the 
> PAF script?

Use .pgpass?:

https://www.postgresql.org/docs/10/libpq-pgpass.html

> 
> We have tried to add the "export PGPASSWORD=123456" in the /etc/profile 
> and it does not work.
> 
> thanks
> 
> 
> 
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-03-06 05:06 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 01:57 How to make PAF use psql to login with password 范国腾 <fanguoteng@highgo.com>
2019-03-06 05:06 ` Adrian Klaver <adrian.klaver@aklaver.com>

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