backup script error with could not connect to database

From: Pepe TD Vo <pepevo(at)yahoo(dot)com>
To: Pgsql-admin <pgsql-admin(at)postgresql(dot)org>, PgAdmin Support List <pgadmin-support(at)lists(dot)postgresql(dot)org>
Subject: backup script error with could not connect to database
Date: 2019-12-18 18:55:26
Message-ID: 280013024.631417.1576695326572@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-admin

hello expert,
I had to do a backup on replication master-slave servers.  I also have asked this question before, but  I don't understand why I followed the information and same scripting to run on the replication servers and didn't work.  I can run pg_dumpall successful but not with the script.  Would you please tell me what's wrong and what need to correct the error?
my replication server (master) pg_hba.conf
# "local" is for Unix domain socket connections onlylocal   all   all                                                     peerhost   all    all                     192.168.2.0/24        trust# IPv4 local connections:host   all   all                       127.0.0.1/32           indentlocal  all   postgres                                            trusthost   all   power_user         0.0.0.0/0               md5host   all   other_user          0.0.0.0/0                md5
host   all   storageLoader    0.0.0.0/0                md5
# IPv6 local connections:host   all   all                        ::1/128                  indent#allow replication connections from localhost, by a user with the replication priviledgelocal   replication   all                                        trusthost   replication   all         127.0.0.1/32           trusthost   replicaiton   all         ::1/128                    trusthost   replication   replicauser     masterIP/32  trusthost   replicaiton   replicauser     slaveIP/32     trust
from the postgres prompt I can connect to each database
#psql -d template0 -U postgres
template0-#
#psql -d template1 -U postgres
template1-#

#psql -d pscidr -U postgres
pscidr-#
#psql -d postgres -U postgres
postgres-#

when I run the script as postgres os, I don't see the error but the only global.sql backup but nothing in it, 0 byte (blank) sql script.
when I run as root su -c postgres /path/pg_backup.sh > pgbackup.log, I get below:

Performing globals backup:Globals backuppg_dumpall: could not connect to database "template1":FATAL: Ident authentication failed for user "postgres" fro globals backup.  
Performing schema-only backup:psql:FATAL: Ident authentication failed for user "postgres"the following databases were matched for schema-only backup:
performing full backup:psql:FATAL: Ident authentication failed for user "postgres"

I can run pg_dumpall > postgresdump.sql as postgres user os fine will all the databases backup
pg_backup.sh and pg_backup.config attachment.
v/r,
Bach-Nga

No one in this world is pure and perfect.  If you avoid people for their mistakes you will be alone. So judge less, love and forgive more.To call him a dog hardly seems to do him justice though in as much as he had four legs, a tail, and barked, I admit he was, to all outward appearances. But to those who knew him well, he was a perfect gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success

Attachment Content-Type Size
pg_backup_config-pg_backup.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document 22.3 KB

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message bw 2019-12-19 12:12:25 Re: backup script error with could not connect to database
Previous Message Alain Dupeyron 2019-12-18 15:15:56 PGAdmin 4: missing preferences setting to copy result headers name

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2019-12-18 19:01:48 Re: Strange inconsistency using psql
Previous Message John Scalia 2019-12-18 18:35:11 Re: Strange inconsistency using psql