【问题标题】:Can't connect postgres_exporter to postgresql database无法将 postgres_exporter 连接到 postgresql 数据库
【发布时间】:2019-04-29 15:46:22
【问题描述】:

我无法将 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 运行实例,所以我无法创建新实例。

【问题讨论】:

    标签: postgresql docker prometheus


    【解决方案1】:

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

    您可以等待this issue 得到解决,使用更新的lib/pq 包自己构建导出器以启用 SCRAM 支持或使用 md5 身份验证。

    【讨论】:

    • 听起来很合理,我正在考虑,但是当我在本地和主机选项中将身份验证方法更改为 md5 时,它并没有帮助 ``` local all all md5 host all all all 127.0.0.1/ 32 md5 ```
    猜你喜欢
    • 1970-01-01
    • 2017-11-27
    • 2013-04-05
    • 2014-03-30
    • 2013-04-19
    • 1970-01-01
    • 2022-12-03
    • 2022-12-05
    • 2019-07-04
    相关资源
    最近更新 更多