我有一个现有的 2 个 kafka 服务器加载了 mysql 连接器。它有效。 我还需要添加MongoDB连接器。 我已经在我的 Kafka 服务器 (Centos7( 上安装了 confluent-schema-registry,它可以工作,我停止/启动/重新启动,看起来没有任何问题。 我已经在这里下载并提取了 debezium Mongo 插件;/usr/connector/plugins/debezium-connector-mongodb/
我已经编辑了/etc/schema-registry/connect-avro-distributed.properties并修改了以下行,如下所示:
plugin.path=share/java,/usr/connector/plugins
bootstrap.servers=kafka3:9092,kafka4:9092
rest.host.name=kafka3
rest.port=8084
rest.advertised.host.name=kafka3
rest.advertised.port=8084
我运行模式注册表,一切正常,插件已加载。我想通过 REST 加载连接器,如下所示:
curl -i -X POST -H "Accept:application/json"
-H "Content-Type:application/json" http://kafka3:8084/connectors/
-d '{
"name": "mongodb-connector",
"config": {
"connector.class": "io.debezium.connector.mongodb.MongoDbConnector",
"mongodb.hosts": "shardreplica01/mongodb-shardsvr1:27017,shardreplica01/mongodb-shardsvr2:27017",
"mongodb.name": "mongoreplica",
"mongodb.user": "debezium",
"mongodb.password": "******",
"database.whitelist": "mongo[.]*",
}
}'
。但显示以下错误,并且无法加载连接器:
HTTP/1.1 500 Internal Server Error
Date: Tue, 21 Jan 2020 20:04:13 GMT
Content-Type: application/json
Content-Length: 350
Server: Jetty(9.4.20.v20190813)
{"error_code":500,"message":"Unexpected character ('}' (code 125)): was expecting double-quote to start field namen at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 9, column: 27] (through reference chain: org.apache.kafka.connect.runtime.rest.entities.CreateConnectorRequest["config"])"}
我需要帮助;我错过了什么?
谢谢
您的 JSON 无效 - 您有一个尾随逗号:
"database.whitelist": "mongo[.]*",
^
|
HERE --------+