Kafka Connect CLI Tutorial
Learn how to use Kafka Connect in standalone mode to write data into Apache Kafka.
Kafka Connect deserves its own section to be learned in-depth, but in this tutorial, we will learn how to leverage Kafka Connect connectors with
connect-standalone to write data into Kafka.
In this tutorial, we will stream the changes of Wikipedia into a Kafka topic.
In order to get data into Apache Kafka, we have seen that we need to leverage Kafka producers. Over time, it has been noticed that many companies shared the same data source types (databases, systems, etc...) and so writing open-source standardized code could be helpful for the greater good. The same thinking goes for Kafka Consumers.
Kafka Connect is a tool that allows us to integrate popular systems with Kafka. It allows us to re-use existing components to source data into Kafka and sink data out from Kafka into other data stores.
Example of popular Kafka Connectors include:
Kafka Connect Source Connectors (producers): Databases (through the Debezium connector), JDBC, Couchbase, GoldenGate, SAP HANA, Blockchain, Cassandra, DynamoDB, FTP, IOT, MongoDB, MQTT, RethinkDB, Salesforce, Solr, SQS, Twitter, etc…
Kafka Connect Sink Connectors (consumers): S3, ElasticSearch, HDFS, JDBC, SAP HANA, DocumentDB, Cassandra, DynamoDB, HBase, MongoDB, Redis, Solr, Splunk, Twitter
To use Kafka Connect in standalone mode, we need to provide the mandatory parameters:
Download a Kafka Connect connector, either from GitHub or Confluent Hub Confluent Hub
Create a configuration file for your connector
connect-standalone.shCLI to start the connector
Create the Kafka topic
wikipedia.recentchange in Kafka with 3 partitions
As well as the topic dead letter queue
wikipedia.dlq, for catching any errors
Download the release JAR and configuration from here and unzip the archive on your computer at
Edit the configuration file
connectors/kafka-connect-sse/connector.properties with the following properties:
Look into your Kafka installation directory (where your
config folders are)
Edit the content of the
The last three lines are the most important to make everything work.
In particular, the
plugin.path config: this is where you indicate the folder where you store your Kafka connectors you have downloaded before.
This must be an absolute path (not relative, and no shortcut with
~) to your
If you fail this step, Kafka Connect will stop after starting it.
Next, we can start our Kafka Connect Standalone connector
And as we can see, the data is flowing into our
There is a lot more to explore in Kafka Connect, this part was meant as an introduction.
Hope you liked it!
Conduktor & Kafka Connect
You've seen how to perform all these tasks using the CLI, but there's no need to keep using such a painful method.
Conduktor Platform can manage your Kafka Connect clusters and configure/start/stop connectors directly from there with just a single click. Try it now