gpt4 book ai didi

mysql - 如何将kafka连接到mysql?

转载 作者:行者123 更新时间:2023-12-04 17:39:08 25 4
gpt4 key购买 nike

我正在尝试在 Windows 上连接 kafka 和 mysql。我没有使用汇合。我的 kafka 版本是 2.12 我已经启动了 zookeeper、Kafka、生产者和消费者,一切正常。

我的MysQL版本是8.0.15

我已经将这 3 个 jar 文件复制到 libs 文件夹中

mysql-connector-java-8.0.15.jar
mysql-connector-java-5.1.47.jar
mysql-connector-java-5.1.47-bin.jar

我的source-quickstart-mysql.properties文件代码是

name=test-source-mysql-jdbc-autoincrement        connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1
connection.url=jdbc:mysql://localhost:3306/databasename?
user=rootname&password=password
mode=incrementing
incrementing.column.name=ID
topic.prefix=my-replicated-topic-table1

当我运行命令时

connect-standalone.bat ..\..\config\connect-standalone.properties  ..\..\config\source-quickstart-mysql.properties

我在控制台上收到这个错误

[2019-03-26 16:16:39,524] ERROR Failed to create job for ....\config\source-quickstart-mysql.properties (org.apache.kafka.connect.cli.ConnectStandalone) [2019-03-26 16:16:39,524] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone) 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.jdbc.JdbcSourc eConnector, available connectors are: PluginDesc{klass=class org.apache.kafka.connect.file.FileStreamSinkConnector, name='org.apache.kafka.connect.file.FileStreamSinkConnector', version='2.1.0', encod edVersion=2.1.0, type=sink, typeName='sink', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.file.FileStreamSourceConnector, name='org.apache.kafka.connect.file.FileStreamSource Connector', version='2.1.0', encodedVersion=2.1.0, type=source, typeName='source', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.MockConnector, name='org.apache.kafka.co nnect.tools.MockConnector', version='2.1.0', encodedVersion=2.1.0, type=connector, typeName='connector', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.MockSinkConnector, name='org.apache.kafka.connect.tools.MockSinkConnector', version='2.1.0', encodedVersion=2.1.0, type=sink, typeName='sink', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tool s.MockSourceConnector, name='org.apache.kafka.connect.tools.MockSourceConnector', version='2.1.0', encodedVersion=2.1.0, type=source, typeName='source', location='classpath'}, PluginDesc{klass=class o rg.apache.kafka.connect.tools.SchemaSourceConnector, name='org.apache.kafka.connect.tools.SchemaSourceConnector', version='2.1.0', encodedVersion=2.1.0, type=source, typeName='source', location='class path'}, PluginDesc{klass=class org.apache.kafka.connect.tools.VerifiableSinkConnector, name='org.apache.kafka.connect.tools.VerifiableSinkConnector', version='2.1.0', encodedVersion=2.1.0, type=source , typeName='source', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.VerifiableSourceConnector, name='org.apache.kafka.connect.tools.VerifiableSourceConnector', version='2 .1.0', encodedVersion=2.1.0, type=source, typeName='source', location='classpath'} at org.apache.kafka.connect.util.ConvertingFutureCallback.result(ConvertingFutureCallback.java:79) at org.apache.kafka.connect.util.ConvertingFutureCallback.get(ConvertingFutureCallback.java:66) at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:110) Caused by: org.apache.kafka.connect.errors.ConnectException: Failed to find any class that implements Connector and which name matches io.confluent.connect.jdbc.JdbcSourceConnector, available connecto rs are: PluginDesc{klass=class org.apache.kafka.connect.file.FileStreamSinkConnector, name='org.apache.kafka.connect.file.FileStreamSinkConnector', version='2.1.0', encodedVersion=2.1.0, type=sink, ty peName='sink', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.file.FileStreamSourceConnector, name='org.apache.kafka.connect.file.FileStreamSourceConnector', version='2.1.0', e ncodedVersion=2.1.0, type=source, typeName='source', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.MockConnector, name='org.apache.kafka.connect.tools.MockConnector', ve rsion='2.1.0', encodedVersion=2.1.0, type=connector, typeName='connector', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.MockSinkConnector, name='org.apache.kafka.connec t.tools.MockSinkConnector', version='2.1.0', encodedVersion=2.1.0, type=sink, typeName='sink', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.MockSourceConnector, name='o rg.apache.kafka.connect.tools.MockSourceConnector', version='2.1.0', encodedVersion=2.1.0, type=source, typeName='source', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools. SchemaSourceConnector, name='org.apache.kafka.connect.tools.SchemaSourceConnector', version='2.1.0', encodedVersion=2.1.0, type=source, typeName='source', location='classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.VerifiableSinkConnector, name='org.apache.kafka.connect.tools.VerifiableSinkConnector', version='2.1.0', encodedVersion=2.1.0, type=source, typeName='source', location= 'classpath'}, PluginDesc{klass=class org.apache.kafka.connect.tools.VerifiableSourceConnector, name='org.apache.kafka.connect.tools.VerifiableSourceConnector', version='2.1.0', encodedVersion=2.1.0, t ype=source, typeName='source', location='classpath'} at org.apache.kafka.connect.runtime.isolation.Plugins.newConnector(Plugins.java:179) at org.apache.kafka.connect.runtime.AbstractHerder.getConnector(AbstractHerder.java:382) at org.apache.kafka.connect.runtime.AbstractHerder.validateConnectorConfig(AbstractHerder.java:261) at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:189) at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:107)

请帮帮我。

我也试过这篇文章,但没有使用命令生成输出 bin/confluent 加载 jdbc-source -d jdbc-source.properties https://supergloo.com/kafka-connect/kafka-connect-mysql-example/

最佳答案

你的错误是

 org.apache.kafka.connect.errors.ConnectException: Failed to find any class that 
implements Connector and which name matches io.confluent.connect.jdbc.JdbcSourceConnector

既然您说您没有使用 Confluent Platform,那是有道理的,因为 kafka-connect-jdbc 不是 Apache Kafka 的一部分。您可以使用 Confluent Platform,从 source 构建连接器, 或在 http://hub.confluent.io 下载.

关于mysql - 如何将kafka连接到mysql?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55355573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com