linux - Google Cloud Ops Agent Mongo 集成错误 - AuthenticationFailed : SCRAM authentication failed, 存储 key 不匹配

标签 linux mongodb google-cloud-platform

我在使用 Google Ops Agent 设置 Mongo 的第 3 方集成时遇到此错误:


AuthenticationFailed: SCRAM authentication failed, storedKey mismatch

Google Cloud Ops Agent Config

Mongo Integration

    mongodb:
      type: mongodb
      insecure: false
      cert_file: /etc/ssl/mongodb.pem
      key_file: /etc/ssl/mongodb.pem
      ca_file: /etc/ssl/mongodb.pem
      endpoint: 127.0.0.1:443
      username: opsplease
      password: Williwork$
      collection_interval: 60s
      insecure_skip_verify: true

完整错误:

"jsonPayload": {
    "context": "conn4277",
    "severity": "I",
    "attributes": {
      "authenticationDatabase": "admin",
      "principalName": "user",
      "mechanism": "SCRAM-SHA-256",
      "client": "1.1.1.1:34542",
      "result": "AuthenticationFailed: SCRAM authentication failed, storedKey mismatch"
    },
    "id": 20249,
    "message": "Authentication failed",
    "component": "ACCESS"
 },

我使用的配置适用于其他实例,并验证了用户和密码是否有效,并且具有数据库所需的权限。

我找不到与此错误相关的任何有用答案,但它似乎在 Google Ops Agent 之外相当常见。任何见解或建议将不胜感激。

最佳答案

问题实际上是密码本身包含 Ops Agent 无法在不转义的情况下处理的字符。

没有其他系统对此密码有任何问题,包括 Robo3T 或连接到复制集的 mongo shell 本身。我曾尝试将密码字符串放在引号中,但这也没有解决问题。

到目前为止导致问题的字符是$。需要转义:

密码:Williwork\$

字符串在 mongoshell 中的外观如何。

mongodb://opsplease:Williwork%24@server1:443,server2:443,server3:443/?authSource=admin&replicaSet=rs0&readPreference=primary&ssl=true&tlsAllowInvalidCertificates=true&tlsAllowInvalidHostnames=true

经过更多测试,我发现您无法在配置中使用百分比编码。

密码:Williwork%24

如果您尝试这样做,它不会在任何日志中显示相同的错误,但指标数据也不会显示,这可以说比抛出错误更糟糕。

我到处寻找解决方案,但没有任何内容与相对较新的 Ops Agent 相关。 ,因此将我自己的问题标记为已回答,以供将来可能发现此问题的任何人使用。我希望有一个来自操作代理的日志,显示它在值解析时被阻塞,但是 /var/log/messages/var/log/google-cloud-ops- agent/subagents/logging-module.log 对此问题没有任何帮助。

关于linux - Google Cloud Ops Agent Mongo 集成错误 - AuthenticationFailed : SCRAM authentication failed, 存储 key 不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74283062/

相关文章:

c++ - boost::mutex::timed_lock 不在 Linux 上

python - 为 python 2.7 安装 mod_wsgi 时出错

mongodb - 如何计算简单表达式

python - 如何使用 django 从 mongodb 数据库中检索数据?

linux - 在 debian wheezy 上运行 autoreconf 和配置所需的软件包

mysql - 从 MySQL 迁移到 MongoDB - 最佳实践

google-cloud-platform - Google Cloud Build 不缓存自定义构建步骤?

python - gcp dataproc 如何在交互式登录和 ssh 命令之间使用相同的 python

magento - 调整机器大小时,SSL 在 Google Cloud Platform 上停止工作

linux - 使用脚本显示信息时出错