5

I am trying to use Debezium to connect to a mysql database on my local machine.

Trying with the following command to call kafka: sudo kafka/bin/connect-standalone.shsh kafka/config/connect-standalone.properties kafka/config/connector.properties

Here is the config in connector.properties:

{
  "name": "inventory-connector",
  "config": {
    "connector.class": "io.debezium.connector.mysql.MySqlConnector",
    "database.hostname": "127.0.0.1",
    "tasks.max": "1",
    "database.port": "3306",
    "database.user": "debezium",
    "database.password": "Password@123",
    "database.server.id": "1",
    "database.server.name": "fullfillment",
    "database.whitelist": "inventory",
    "database.history.kafka.bootstrap.servers": "localhost:9092",
    "database.history.kafka.topic": "dbhistory.fullfillment",
    "include.schema.changes": "true",
    "type": "null"
  }
}

Getting the following error while running the mentioned command:

[2018-12-07 10:58:17,102] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:113)
java.util.concurrent.ExecutionException: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: Connector config {"config"={, "type"="null", "database.user"="debezium",, "database.port"="3306",, "include.schema.changes"="true",, "database.server.name"="fullfillment",, "connector.class"="io.debezium.connector.mysql.MySqlConnector",, "tasks.max"="1",, "database.history.kafka.topic"="dbhistory.fullfillment",, "database.server.id"="1",, "database.whitelist"="inventory",, "name"="inventory-connector",, "database.hostname"="127.0.0.1",, {=, "database.password"="Password@123",, }=, "database.history.kafka.bootstrap.servers"="localhost:9092",} contains no connector type
    at org.apache.kafka.connect.util.ConvertingFutureCallback.result(ConvertingFutureCallback.java:79)
    at org.apache.kafka.connect.util.ConvertingFutureCallback.get(ConvertingFutureCallback.java:66)
    at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:110)
Caused by: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: Connector config {"config"={, "type"="null", "database.user"="debezium",, "database.port"="3306",, "include.schema.changes"="true",, "database.server.name"="fullfillment",, "connector.class"="io.debezium.connector.mysql.MySqlConnector",, "tasks.max"="1",, "database.history.kafka.topic"="dbhistory.fullfillment",, "database.server.id"="1",, "database.whitelist"="inventory",, "name"="inventory-connector",, "database.hostname"="127.0.0.1",, {=, "database.password"="Password@123",, }=, "database.history.kafka.bootstrap.servers"="localhost:9092",} contains no connector type
    at org.apache.kafka.connect.runtime.AbstractHerder.validateConnectorConfig(AbstractHerder.java:259)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:189)
    at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:107)

Any help will be highly appreciated.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

3 Answers3

5

connector.properites for standalone mode requires property file format. So please take config section and rewrite it like

connector.class=io.debezium.connector.mysql.MySqlConnector
.
.
.
Jiri Pechanec
  • 1,816
  • 7
  • 8
5

You have a JSON file, not a property file.

This is meant to be used with connect-distributed mode. And POSTed via HTTP to the Kafka Connect REST API, not as a CLI argument.

For connect-standalone, you provide both the Connect worker properties and the connector properties files at the same time, as Java .properties files.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
0

connector.properties files format should be yml,not json.

yu yong
  • 3
  • 3