无法将postgres_exporter连接到postgresql数据库

3

我无法将postgres_exporter连接到postgresql数据库。我得到了

time="2019-04-29T15:37:46Z" level=info msg="Established new database connection to \"localhost:5432\"." source="postgres_exporter.go:767"
time="2019-04-29T15:37:46Z" level=error msg="Error opening connection to database (postgresql://postgres:PASSWORD_REMOVED@localhost:5432/postgres?sslmode=disable): pq: unknown authentication response: 10" source="postgres_exporter.go:1260"
time="2019-04-29T15:37:46Z" level=info msg="Starting Server: :9187" source="postgres_exporter.go:1360"
端口和密码都正确。当我尝试运行它时,出现了以下错误:

# Start an example database
docker run --net=host -it --rm -e POSTGRES_PASSWORD=password postgres
# Connect to it
docker run --net=host -e DATA_SOURCE_NAME="postgresql://postgres:password@localhost:5432/postgres?sslmode=disable" wrouesnel/postgres_exporter

它可以完美运行,但已经有正在运行的postgresql实例,因此我无法创建新实例。

2个回答

3

看起来你正在使用数据库中的SCRAM身份验证,但是postgres_exporter尚不支持它。

你可以等待解决这个问题,使用更新的lib/pq软件包构建exporter以启用SCRAM支持,或者使用md5身份验证。


听起来很合理,我也在考虑这个问题,但是当我将本地和主机选项中的身份验证方法更改为md5时,它并没有起到帮助作用。本地 all all md5 主机 all all 127.0.0.1/32 md5 - mikeProgrammer

0

我也遇到了这个问题。我将 localhost 更改为 127.0.0.1 在 DATA_SOURCE_NAME 中以解决这个问题。

DATA_SOURCE_NAME="postgresql://postgres:password@127.0.0.1:5432/postgres?sslmode=disable"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,