为什么我的kafka连接到mysql8.0总是遇到问题?

Why my kafka connects to mysql8.0 always encounters problem?

当我尝试使用 kafka connect 连接到 mysql8.0 时,我的 driver 总是有问题。 问题是 no suitable driver for found

这是为新的 CentOS7 准备的 plugin.path = [share/java, /root/confluent-5.2.1/share/confluent-hub-components] /root/confluent-5.2.1/share/confluent-hub-components目录下, 有两个 drivers:

[root@localhost confluent-hub-components]# ls
confluentinc-kafka-connect-jdbc  debezium-debezium-connector-mysql

我的 driver 是

[root@localhost confluent-hub-components]# cd confluentinc-kafka-connect-jdbc/
[root@localhost confluentinc-kafka-connect-jdbc]# ls
assets  doc  etc  lib  manifest.json
[root@localhost confluentinc-kafka-connect-jdbc]# cd lib
[root@localhost lib]# ls
audience-annotations-0.5.0.jar  jline-0.9.94.jar  kafka-connect-jdbc-5.2.1.jar  postgresql-9.4-1206-jdbc41.jar  sqlite-jdbc-3.25.2.jar  zookeeper-3.4.13.jar
common-utils-5.2.1.jar          jtds-1.3.1.jar    netty-3.10.6.Final.jar        slf4j-api-1.7.25.jar            zkclient-0.10.jar

这是我的代码

 bin/connect-standalone etc/schema-registry/connect-avro-standalone.properties etc/kafka-connect-jdbc/mysql-source.properties

mysql-source.属性:

#tasks to create:
name=jdbc-source-mysql-01
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
#tasks.max=1
# a table called 'users' will be written to the topic 'test-mysql-jdbc-users'.
connection.user=root
connection.password=root
connection.url=jdbc:mysql://localhost:3306/employees
mode=bulk
#incrementing.column.name=fdsid
topic.prefix=test-mysql-jdbc-

错误:

Invalid value java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/employees for configuration Couldn't open connection to jdbc:mysql://localhost:3306/employees

MySQL 驱动程序 不附带 Kafka Connect JDBC 连接器。您必须自己安装并安装在正确的位置。

在启动 Kafka Connect worker之前,您需要将相关的 MySQL JDBC 驱动程序 JAR 放入 Kafka Connect JDBC 文件夹中

This post 将帮助您了解更多细节。