Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka Connect can't find connector

I'm trying to use the Kafka Connect Elasticsearch connector, and am unsuccessful. It is crashing with the following error:

[2018-11-21 14:48:29,096] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:108)
java.util.concurrent.ExecutionException: org.apache.kafka.connect.errors.ConnectException: Failed to find any class that implements Connector and which name matches io.confluent.connect.elasticsearch.ElasticsearchSinkConnector , available connectors are: PluginDesc{klass=class org.apache.kafka.connect.file.FileStreamSinkConnector, name='org.apache.kafka.connect.file.FileStreamSinkConnector', version='1.0.1', encodedVersion=1.0.1, type=sink, typeName='sink', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.file.FileStreamSourceConnector, name='org.apache.kafka.connect.file.FileStreamSourceConnector', version='1.0.1', encodedVersion=1.0.1, type=source, typeName='source', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.MockConnector, name='org.apache.kafka.connect.tools.MockConnector', version='1.0.1', encodedVersion=1.0.1, type=connector, typeName='connector', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.MockSinkConnector, name='org.apache.kafka.connect.tools.MockSinkConnector', version='1.0.1', encodedVersion=1.0.1, type=sink, typeName='sink', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.MockSourceConnector, name='org.apache.kafka.connect.tools.MockSourceConnector', version='1.0.1', encodedVersion=1.0.1, type=source, typeName='source', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.SchemaSourceConnector, name='org.apache.kafka.connect.tools.SchemaSourceConnector', version='1.0.1', encodedVersion=1.0.1, type=source, typeName='source', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.VerifiableSinkConnector, name='org.apache.kafka.connect.tools.VerifiableSinkConnector', version='1.0.1', encodedVersion=1.0.1, type=source, typeName='source', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.VerifiableSourceConnector, name='org.apache.kafka.connect.tools.VerifiableSourceConnector', version='1.0.1', encodedVersion=1.0.1, type=source, typeName='source', location='classpath'}

I've got a build for the plugin unzipped in a kafka subfolder, and have the following line in connect-standalone.properties:

plugin.path=/opt/kafka/plugins/kafka-connect-elasticsearch-5.0.1/src/main/java/io/confluent/connect/elasticsearch

I can see the various connectors inside that folder, but Kafka Connect does not load them; but it does load the standard connectors, like this:

[2018-11-21 14:56:28,258] INFO Added plugin 'org.apache.kafka.connect.transforms.Cast$Value' (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:136)
[2018-11-21 14:56:28,259] INFO Added aliases 'FileStreamSinkConnector' and 'FileStreamSink' to plugin 'org.apache.kafka.connect.file.FileStreamSinkConnector' (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:335)
[2018-11-21 14:56:28,260] INFO Added aliases 'FileStreamSourceConnector' and 'FileStreamSource' to plugin 'org.apache.kafka.connect.file.FileStreamSourceConnector' (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:335)

How can I properly register the connectors?

like image 959
Boris K Avatar asked Nov 21 '18 13:11

Boris K


People also ask

How do I add connectors to Kafka connect?

Install Connector Manually Kafka Connect isolates each plugin so that the plugin libraries do not conflict with each other. To manually install a connector: Find your connector on Confluent Hub and download the connector ZIP file. Extract the ZIP file contents and copy the contents to the desired location.

How do I check my Kafka connector status?

You can use the REST API to view the current status of a connector and its tasks, including the ID of the worker to which each was assigned. Connectors and their tasks publish status updates to a shared topic (configured with status. storage. topic ) which all workers in the cluster monitor.

Where are Kafka connectors stored?

A reference configuration for distributed mode can be found at $CONFLUENT_HOME/etc/kafka/connect-distributed.

Is Kafka connect mandatory?

Kafka Connect is a mandatory piece to build a complete and flexible data streaming platform.

How do I troubleshoot Kafka Connect connectors?

Troubleshooting your Kafka connectors If you are encountering problems in running your connectors on the Instaclustr managed service, consider using some of these troubleshooting techniques: Monitoring and the REST API Use the Monitoring section of the instaclustr console to check metrics related to the operation of your Kafka Connect cluster.

How do I send Kafka Connect logs to instaclustr?

The logs from your running Kafka Connect cluster can be optionally shipped to your Kafka cluster (If using an Instaclustr managed Kafka cluster). You can turn this option on in the Connectors page of the Kafka Connect section of the Instaclustr console. Simply select the checkbox, then press the Save button.

What are the key features of Kafka Connect?

Kafka Connect features include: A framework for connecting external systems with Kafka – it simplifies the development, deployment, and management of connectors

How to stream data from Apache Kafka to confluent?

Kafka Connect (which is part of Apache Kafka) supports pluggable connectors, enabling you to stream data between Kafka and numerous types of system, including to mention just a few: The appropriate plugin for the technology which you want to integrate can be found on Confluent Hub.


1 Answers

I ran jdbc connector yesterday manually on kafka in docker without confluent platform etc just to learn how those things works underneath. I did not have to build jar on my side or anyhing like this. Hopefully it will be relevant for you - what I did is ( I will skip docker parts howto mount dir with connector etc ):

  • download connector from https://www.confluent.io/connector/kafka-connect-jdbc/, unpack zip
  • put contents of zip to directory in path configured in properties file ( shown below in 3rd point ) -

    plugin.path=/plugins
    

    so tree looks something like this:

    /plugins/
    └── jdbcconnector
        └──assets
        └──doc
        └──etc
        └──lib
    

    Note the lib dir where are the dependencies are, one of them is kafka-connect-jdbc-5.0.0.jar

  • Now you can try to run connector

    ./connect-standalone.sh connect-standalone.properties jdbc-connector-config.properties
    

    connect-standalone.properties are common properties needed for kafka-connect, in my case:

    bootstrap.servers=localhost:9092
    key.converter=org.apache.kafka.connect.json.JsonConverter
    value.converter=org.apache.kafka.connect.json.JsonConverter
    key.converter.schemas.enable=true
    value.converter.schemas.enable=true
    offset.storage.file.filename=/tmp/connect.offsets
    offset.flush.interval.ms=10000
    plugin.path=/plugins
    rest.port=8086
    rest.host.name=127.0.0.1
    

    jdbc-connector-config.properties is more involving, as it's just configuration for this particular connector, you need to dig into connector docs - for jdbc source it is https://docs.confluent.io/current/connect/kafka-connect-jdbc/source-connector/source_config_options.html

like image 61
hi_my_name_is Avatar answered Nov 25 '22 17:11

hi_my_name_is