Kafka-MongoDB源和汇连接器

ufj5ltwl  于 5个月前  发布在  Apache
关注(0)|答案(1)|浏览(47)

我已经创建了一个3 VM Kafka集群,并在每个VM上安装了mongoDB。此外,运行kafka-mongoDB连接器。我在第一个VM上的源连接器配置是:

{
  "name": "source1",
  "config": {
    "connector.class": "com.mongodb.kafka.connect.MongoSourceConnector",
    "connection.uri": "mongodb://localhost:27017",
    "publish.full.document.only": true,
    "database": "Ecomm1",
    "collection": "orders"
  }
}

字符串
我在第二个和第三个VM上的Sink Connector配置是:

{
  "name": "sink1",
  "config": {
    "connector.class": "com.mongodb.kafka.connect.MongoSinkConnector",
    "topics": "Ecomm1.orders",
    "connection.uri": "mongodb://localhost:27017",
    "key.converter": "org.apache.kafka.connect.storage.StringConverter",
    "value.converter": "org.apache.kafka.connect.json.JsonConverter",
    "value.converter.schemas.enable": false,
    "database": "Ecomm",
    "collection": "orders"
  }
}


使用此设置,当我在第一个VM的集合中插入文档时,它会在第二个或第三个VM的DB中反映。而不是在两者上。我在这里遗漏了什么?我希望第一个VM上的插入也会在第二个和第三个MongoDB上反映。我不希望复制设置。

i2loujxw

i2loujxw1#

名字应该不同。那么它工作得很好。谢谢。关闭此票证。

相关问题