Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1Lf0-0005sZ-OK for pgsql-general@arkaria.postgresql.org; Wed, 06 Mar 2019 01:47:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1Lez-0003PW-Ge for pgsql-general@arkaria.postgresql.org; Wed, 06 Mar 2019 01:47:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1Lez-0003PO-4a for pgsql-general@lists.postgresql.org; Wed, 06 Mar 2019 01:47:53 +0000 Received: from [124.133.18.218] (helo=EX02.highgo.com) by makus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1Let-0003eh-5H for pgsql-general@postgresql.org; Wed, 06 Mar 2019 01:47:51 +0000 Received: from EX02.highgo.com (192.168.110.195) by EX02.highgo.com (192.168.110.195) with Microsoft SMTP Server (TLS) id 15.0.847.32; Wed, 6 Mar 2019 09:57:58 +0800 Received: from EX02.highgo.com ([fe80::6867:ae31:6e38:a84f]) by EX02.highgo.com ([fe80::6867:ae31:6e38:a84f%10]) with mapi id 15.00.0847.030; Wed, 6 Mar 2019 09:57:58 +0800 From: =?gb2312?B?t7a5+sza?= To: "pgsql-general@postgresql.org" , "users@clusterlabs.org" CC: =?gb2312?B?xu67qsX0?= Subject: How to make PAF use psql to login with password Thread-Topic: How to make PAF use psql to login with password Thread-Index: AQHU076kgqPquZZY/0Cj2VHwl2Z/xA== Date: Wed, 6 Mar 2019 01:57:58 +0000 Message-ID: <79886fabd93e4b83b19c55f97b4210ef@EX02.highgo.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [112.254.101.122] Content-Type: multipart/alternative; boundary="_000_79886fabd93e4b83b19c55f97b4210efEX02highgocom_" MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 124.133.18.218 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_79886fabd93e4b83b19c55f97b4210efEX02highgocom_ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 SGksDQoNCldlIHVzZSB0aGUgUEFGIChodHRwczovL2RhbGliby5naXRodWIuaW8vUEFGLz8pIHRv IG1hbmFnZSB0aGUgcG9zdGdyZXNxbC4NCg0KDQpBY2NvcmRpbmcgdG8gdXNlcidzIHJlcXVpcmVt ZW50LCB3ZSBjb3VsZCBub3QgdXNlIHRydXN0IG1vZGUgaW4gdGhlIHBnX2hiYS5jb25mPyBmaWxl LiBTbyB3aGVuIHJ1bm5pbmcgcHNxbCwgaXQgd2lsbCBhc2sgdXMgdG8gaW5wdXQgdGhlIHBhc3N3 b3JkIGFuZCB3ZSBoYXZlIHRvIGlucHV0IHRoZSBwYXNzd29yZCBtYW51YWxseS4NCg0KDQpTbyB0 aGUgcGNzIHN0YXR1cyBzaG93IHRoZSBmb2xsb3dpbmcgZXJyb3I6DQoNCiogcGdzcWxkX3N0b3Bf MCBvbiBub2RlMS1wcmkgJ3Vua25vd24gZXJyb3InICgxKTogY2FsbD0zNCwgc3RhdHVzPWNvbXBs ZXRlLCBleGl0cmVhc29uPSdVbmV4cGVjdGVkIHN0YXRlIGZvciBpbnN0YW5jZSAicGdzcWxkIiAo cmV0dXJuZWQgMSknLA0KICAgIGxhc3QtcmMtY2hhbmdlPSdXZWQgTWFyICA2IDA5OjA5OjQ2IDIw MTknLCBxdWV1ZWQ9MG1zLCBleGVjPTUwNG1zDQoNCg0KDQpUaGUgY2F1c2Ugb2YgdGhlIGVycm9y IGlzIHRoYXQgdGhlIFBBRiAoL3Vzci9saWIvb2NmL3Jlc291cmNlLmQvaGVhcnRiZWF0L3Bnc3Fs bXMpICB3aWxsIGFzayB0byBpbnB1dCB0aGUgcGFzc3dvcmQgYW5kIHdlIGNvdWxkIG5vdCBwYXNz IHRoZSBwYXNzd29yZCB0byBwc3FsIGNvbW1hbmQgaW4gdGhlIFBBRiBzY3JpcHQuDQoNCg0KICAg ICAgICBleGVjICRQR1BTUUwsICctLXNldCcsICdPTl9FUlJPUl9TVE9QPTEnLCAnLXFYQXRmJywg JHRtcGZpbGUsDQogICAgJy1SJywgJFJTLCAnLUYnLCAkRlMsICctLXBvcnQnLCAkcGdwb3J0LCAn LS1ob3N0JywgJHBnaG9zdCwnLS11c2VybmFtZScsJ3N5c2RiYScsDQoNCklzIHRoZXJlIGFueSB3 YXkgZm9yIHVzIHRvIHBhc3MgdGhlIHBhc3N3b3JkIHRvIHRoZSBwc3FsIGNvbW1hbmQgaW4gdGhl IFBBRiBzY3JpcHQ/DQoNCldlIGhhdmUgdHJpZWQgdG8gYWRkIHRoZSAiZXhwb3J0IFBHUEFTU1dP UkQ9MTIzNDU2IiBpbiB0aGUgL2V0Yy9wcm9maWxlIGFuZCBpdCBkb2VzIG5vdCB3b3JrLg0KDQp0 aGFua3MNCg0KDQoNCg0KDQoNCg== --_000_79886fabd93e4b83b19c55f97b4210efEX02highgocom_ Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable

Hi,

We use the PAF (https://dalibo.github.i= o/PAF/​) to manage the postgr= esql.


According to user's requirement, we cou= ld 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 passwor= d manually.


So the pcs status show the following error:

* pgsqld_stop_0 on node1-pri 'unknown error' (1): call=3D34, status=3D= complete, exitreason=3D'Unexpected state for instance "pgsqld" (r= eturned 1)',
    last-rc-change=3D'Wed Mar  6 09:09:46 2019', queued= =3D0ms, exec=3D504ms



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=3D1'= , '-qXAtf', $tmpfile,
    '-R', $RS, '-F', $FS, '--port', $pgport, '--host', $pgho= st,'--username','sysdba',

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

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

thanks






--_000_79886fabd93e4b83b19c55f97b4210efEX02highgocom_--