timescale / prometheus-postgresql-adapter

Use PostgreSQL as a remote storage database for Prometheus
Apache License 2.0
335 stars 66 forks source link

err="pq: password authentication failed for user \"postgres\"" #72

Closed aioloszcy closed 5 years ago

aioloszcy commented 5 years ago

According to Getting started with Prometheus and TimescaleDB, when I start the prometheus_postgresql_adapter container, I get an error. level=info ts=2019-04-18T06:46:39.906315481Z caller=log.go:25 config="&{remoteTimeout:30000000000 listenAddr::9201 telemetryPath:/metrics pgPrometheusConfig:{host:pg_prometheus port:5432 user:postgres password: database:postgres schema: sslMode:disable table:metrics copyTable: maxOpenConns:50 maxIdleConns:10 pgPrometheusNormalize:true pgPrometheusLogSamples:true pgPrometheusChunkInterval:43200000000000 useTimescaleDb:true dbConnectRetries:0 readOnly:false} logLevel:debug haGroupLockId:0 restElection:false prometheusTimeout:-1}" level=info ts=2019-04-18T06:46:39.906416995Z caller=log.go:25 msg="host=pg_prometheus port=5432 user=postgres dbname=postgres password='' sslmode=disable connect_timeout=10" level=error ts=2019-04-18T06:46:39.910818007Z caller=log.go:33 err="pq: password authentication failed for user \"postgres\""

niksajakovljevic commented 5 years ago

Hmmm.... I wonder if that's due to different security setting in newest docker image. Can you specify what docker images were used? Would be useful to try ssh-ing into pg_prometheus docker and try connecting to db from inside (in case db only allows connections from localhost)

aioloszcy commented 5 years ago

thks! docker images are all the latest. I solved the problem by added the following line to the pg_hba.conf configuration file: host postgres postgres 0.0.0.0/0 trust The pg_hba.conf path is in "/var/lib/docker/volumes/docker mount path/_data"

admiral-manjinder commented 5 years ago

@aioloszcy @niksajakovljevic even that didn't work for mee :( any thing else to fix this ? as a side note, if i create a separate db and pass its details to postgres-adapter, it is able to connect with that seamlessly..

freddielunchbird commented 5 years ago

Hi,

It worked after i restarted the container. Here is what i did:

1) figure out where the pg_hba.conf is located: sudo find /var/lib/docker/volumes -name "pg_hba*"

2) I added the host postgres postgres 0.0.0.0/0 trust just above 'host all all all md5' line

3) Then i restarted the pg_prometheus container: docker restart

4) start the prometheus_postgresql_adapter container, you may have to remove it first.