pgpool/pgpool2_exporter

Authentication issues

Closed this issue · 2 comments

I have been banging my head against a wall trying to sort this out. I'm hoping the community can offer me some advice!

I have a pgpool cluster up at postgresql.stage.hq.foobar.com
I have a postgres user called osit_metrics assigned the pg_monitor role.

I can connect to pgpool as this user using psql.

$ PGPASSWORD=testpassword psql -U osit_metrics -h postgresql.stage.hq.foobar.com postgres -c 'select 1=1';
 ?column? 
----------
 t
(1 row)

But I can't get pgpool_exporter to authenticate using the same credentials

$ export DATA_SOURCE_NAME="postgresql://osit_metrics:testpassword@postgresql.stage.hq.foobar.com/postgres?sslmode=disable"
$ /usr/local/bin/pgpool2_exporter 
ts=2022-06-28T17:25:29.761Z caller=pgpool2_exporter.go:231 level=error err="error connecting to Pgpool-II: pq: client authentication failed"

# with ssl
$ export DATA_SOURCE_NAME="postgresql://osit_metrics:testpassword@postgresql.stage.hq.foobar.com/postgres?sslmode=require"
$ /usr/local/bin/pgpool2_exporter 
ts=2022-06-28T17:26:03.182Z caller=pgpool2_exporter.go:231 level=error err="error connecting to Pgpool-II: pq: unexpected authentication response: 'R'"

Any tips?

@ngharo
It seems that the client authentication failed.
To figure out the cause the detailed error messages is required.

Could you check if the detailed logs were output to pgpool logs?
Could you share your pgpool.conf and pool_hba.conf (if it's used)?

Thanks for the reply @pengbo0328.

I was able to get it working. In my pool_hba.conf file, I have auth method set to password. This passes through authentication to the backend. For some reason, I'm still not 100% clear on, I needed to add my osit_metrics users to the pool_passwd file.

Other pg users don't need to be in to pool file.