Kafka 连接器 mongoDB 源的工作示例?

问题描述 投票:0回答:1

我无法让它发挥作用。

这是我的 json 配置:

{
  "name": "lastlook-mongodb-source-connector",
  "config": {
    "connector.class": "com.mongodb.kafka.connect.MongoSourceConnector",
    "tasks.max": "4",
    "connection.uri": "mongodb://user:pass@machine1:27017,machine2:27017/?authSource=admin",
    "database": "DB",
    "collection": "Collection",
    "topic": "Topic",
    "startup_mode": "copy_existing",
    "pipeline":"[]",
    "change.stream.full.document":"updateLookup",
    "producer.override.sasl.mechanism": "SCRAM-SHA-256",
    "producer.override.security.protocol": "SASL_PLAINTEXT",
    "producer.override.sasl.jaas.config": "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"user\" password=\"pass\";"
  }
}

但由于某种原因我遇到了错误:

{"error_code":400,"message":"连接器配置无效并包含以下 1 个错误: 用户权限无效。缺少以下操作权限:changeStream 您还可以在端点处找到上面的错误列表

/connector-plugins/{connectorType}/config/validate
"}

这根本不清楚。

有这方面的信息吗?

mongodb apache-kafka-connect
1个回答
0
投票

首先检查您在“connection.uri”中使用的用户是否具有在 MongoDB 中执行 ChangeStream 操作所需的权限。

您尝试执行的操作需要 changeStream 操作(“change.stream.full.document”:“updateLookup”)。

尝试向用户添加权限或使用具有必要权限的其他用户,例如root

© www.soinside.com 2019 - 2024. All rights reserved.