简体   繁体   English

向Kafka Connect添加连接器

[英]Adding a connector to Kafka Connect

I am using Confluent Kafka Docker image, specifically using this: https://github.com/confluentinc/cp-docker-images/tree/4.0.x/examples/cp-all-in-one 我正在使用Confluent Kafka Docker映像,特别是使用此映像: https : //github.com/confluentinc/cp-docker-images/tree/4.0.x/examples/cp-all-in-one

I want to add the MySQL connector, by: 我想通过以下方式添加MySQL连接器:

Basically, extrapolating the part of interest form the compose file, this is the important snippet: 基本上,从组成文件中推断出感兴趣的部分,这是重要的代码段:

environment:
  <cut>
  CONNECT_PLUGIN_PATH: '/etc/kafka-connect/jars/'
volumes:
  - "./mysql_connector:/etc/kafka-connect/jars/"

The JAR is correctly present in the Docker container. JAR已正确存在于Docker容器中。

But, of course, if I try to use the connector, I can't find in the list of the enabled connectors. 但是,当然,如果尝试使用连接器,则无法在已启用的连接器列表中找到。 If I go to control center, I see: 如果我去控制中心,我会看到:

[{
    "class": "org.apache.kafka.connect.file.FileStreamSinkConnector",
    "type": "sink",
    "version": "1.0.0-cp1"
}, {
    "class": "org.apache.kafka.connect.file.FileStreamSourceConnector",
    "type": "source",
    "version": "1.0.0-cp1"
}]

Your plugin path needs to contain the path to the actual JDBC Connect JAR files as well as the MySQL JAR 您的插件路径需要包含实际JDBC Connect JAR文件以及MySQL JAR的路径

If you mount the MySQL JAR under this path 如果在此路径下安装MySQL JAR

/usr/share/java/kafka-connect-jdbc

Then set the CONNECT_PLUGIN_PATH=/usr/share/java , then you have access to all bundled connectors. 然后设置CONNECT_PLUGIN_PATH=/usr/share/java ,然后您就可以访问所有捆绑的连接器。 And the JDBC Connector will be able to read/write MySQL data. JDBC连接器将能够读取/写入MySQL数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM