1
votes

I've an existing 2 kafka servers loaded mysql connector. It works. Also I need to add MongoDB connector. I've installed confluent-schema-registry on my Kafka servers (Centos7), it works, I stop/start/restart, nothing looks wrong. I've downloaded and extracted debezium Mongo plugins here; /usr/connector/plugins/debezium-connector-mongodb/

I've edited /etc/schema-registry/connect-avro-distributed.properties and modified following lines as below:

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

I run schema-registry and everything is ok, plugins are loaded. I would like to load connector via REST as below:

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[.]*",
  }
}'

...but the following error is displayed and the connector cannot be loaded:

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 name\n 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\"])"}

I need to help; what am I missing?

Thanks

1

1 Answers

1
votes

Your JSON is invalid - you have a trailing comma :

"database.whitelist": "mongo[.]*",
                                 ^
                                 |
                    HERE --------+