There are several ways to install and use Debezium connectors, so we’ve documented a few of the most common ways to do this.
Installing a Debezium connector
If you’ve already installed Zookeeper, Kafka, and Kafka Connect, then using one of Debezium’s connectors is easy. Simply download one or more connector plugin archives (see below), extract its files into your Kafka Connect environment, and add the directory with the JARs to Kafka Connect’s classpath. Restart your Kafka Connect process to pick up the new JARs.
The connector plugins are available from Maven:
If immutable containers are your thing, then check out Debezium’s Docker images for Zookeeper, Kafka, and Kafka Connect with the MySQL and MongoDB connectors already pre-installed and ready to go. Our tutorial even walks you through using these images, and this is a great way to learn what Debezium is all about. You can even run Debezium on Kubernetes and OpenShift.
Using a Debezium connector
To use a connector to produce change events for a particular source server/cluster, simply create a configuration file for the MySQL Connector or MongoDB Connector, and use the Kafka Connect REST API to add that connector configuration to your Kafka Connect cluster. When the connector starts, it will connect to the source and produce events for each inserted, updated, and deleted row or document. See the Debezium documentation for the MySQL Connector and MongoDB Connector.
Using the Debezium libraries
Although Debezium is really intended to be used as turnkey services, all of Debezium’s JARs and other artifacts are available in Maven Central. For example, you might want to use our MySQL DDL parser from our MySQL connector library to parse those DDL statments in your consumers of the MySQL schema change topics.
We do provide a small library so applications can embed any Kafka Connect connector and consume data change events read directly from the source system. This provides a much lighter weight system (since Zookeeper, Kafka, and Kafka Connect services are not needed), but as a consequence is not as fault tolerant or reliable since the application must manage and maintain all state normally kept inside Kafka’s distributed and replicated logs. It’s perfect for use in tests, and with careful consideration it may be useful in some applications.