kafka-connect-jdbc:SQLException:仅在使用分布式模式时没有合适的驱动程序

kafka-connect-jdbc : SQLException: No suitable driver only when using distributed mode(kafka-connect-jdbc:SQLException:仅在使用分布式模式时没有合适的驱动程序)
本文介绍了kafka-connect-jdbc:SQLException:仅在使用分布式模式时没有合适的驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我们已经成功地使用了 mySQL - 使用 jdbc 独立连接器的 kafka 数据摄取,但现在面临在分布式模式下使用相同的问题(作为 kafka 连接服务).

We have successfully used mySQL - kafka data ingestion using jdbc standalone connector but now facing issue in using the same in distributed mode (as kafka connect service ).

connect-distributed.properties 文件-

connect-distributed.properties file-

bootstrap.servers=IP1:9092,IP2:9092
group.id=connect-cluster
key.converter.schemas.enable=true
value.converter.schemas.enable=true
offset.storage.topic=connect-offsets
offset.storage.replication.factor=2
config.storage.topic=connect-configs
config.storage.replication.factor=2
status.storage.topic=connect-status
status.storage.replication.factor=2
offset.flush.interval.ms=10000
plugin.path=/usr/share/java,/usr/share/java/kafka-connect-jdbc

我有我的连接器罐子-

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

-rw-r--r-- 1 root root  906708 Jul 29 01:18 zookeeper-3.4.13.jar
-rw-r--r-- 1 root root   74798 Jul 29 01:18 zkclient-0.10.jar
-rw-r--r-- 1 root root 5575351 Jul 29 01:18 sqlite-jdbc-3.8.11.2.jar
-rw-r--r-- 1 root root   41203 Jul 29 01:18 slf4j-api-1.7.25.jar
-rw-r--r-- 1 root root  658466 Jul 29 01:18 postgresql-9.4-1206-jdbc41.jar
-rw-r--r-- 1 root root 1292696 Jul 29 01:18 netty-3.10.6.Final.jar
-rw-r--r-- 1 root root  489884 Jul 29 01:18 log4j-1.2.17.jar
-rw-r--r-- 1 root root  211219 Jul 29 01:18 kafka-connect-jdbc-5.0.0.jar
-rw-r--r-- 1 root root  317816 Jul 29 01:18 jtds-1.3.1.jar
-rw-r--r-- 1 root root   87325 Jul 29 01:18 jline-0.9.94.jar
-rw-r--r-- 1 root root   20844 Jul 29 01:18 common-utils-5.0.0.jar
-rw-r--r-- 1 root root   20437 Jul 29 01:18 audience-annotations-0.5.0.jar
-rw-r----- 1 root root 2132635 Nov 11 16:31 mysql-connector-java-8.0.13.jar

我可以通过这种方式运行脚本来运行独立模式-

I am able to run the standalone mode by running the script in this way-

/usr/bin/connect-standalone /etc/kafka/connect-standalone.properties /etc/kafka-connect-jdbc/source-quickstart-mysql.properties

但是当我尝试调用 REST API 来运行分布式模式连接器时,出现错误:

But when I try to invoke the REST API to run a distributed mode connector , I get the error:

curl -X POST -H "Accept:application/json" -H "Content-Type:application/json" X.X.X.X:8083/connectors/ -d '{"name": "linuxemp-connector", "config": { "connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector", "tasks.max": "1", "connection.url": "jdbc:mysql://Y.Y.Y.Y:3306/linux_db?user=groot&password=pwd","table.whitelist": "emp","mode": "timestamp","incrementing.column.name":"empid","topic.prefix": "mysqlconnector-" } }'

错误-

{"error_code":400,"message":"Connector configuration is invalid and contains the following 2 error(s):\nInvalid value java.sql.SQLException: No suitable driver found for jdbc:mysql://Y.Y.Y.Y:3306/linux_db?user=groot&password=pwd for configuration Couldn't open connection to jdbc:mysql://Y.Y.Y.Y:3306/linux_db?user=groot&password=pwd\nInvalid value java.sql.SQLException: No suitable driver found for jdbc:mysql://Y.Y.Y.Y:3306/linux_db?user=groot&password=pwd for configuration Couldn't open connection to jdbc:mysql://Y.Y.Y.Y:3306/linux_db?user=groot&password=pwd\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"}

注意-连接器 jars 放置在所有连接节点上,plugin.path 在所有连接节点上都相同,并且 kafka-connect 服务已启动并运行.

note- connector jars are placed on all connect nodes , plugin.path is same on all connect nodes and kafka-connect service is up and running .

我错过了什么?为什么我无法提交 REST 调用来启动此 mysql 管道的分布式连接工作器/任务?这在独立模式下非常有效.但是在分布式模式下抛出错误.

What am I missing ? Why am I not able to submit REST call to start a distributed connect worker/task for this mysql pipeline ? This works absolutely fine with standalone mode . But throws error with distributed mode .

请帮忙!

谢谢!

推荐答案

通过修复以下问题,问题得到解决 -

By fixing below things, the issue got resolved -

1.修改/usr/share/java/kafka-connect-jdbc/mysql-connector-java-8.0.13.jar的权限为7552.在插件路径中只保留/usr/share/java.

1.Changed permissions of /usr/share/java/kafka-connect-jdbc/mysql-connector-java-8.0.13.jar to 755 2.Keep only /usr/share/java in plugin path.

3.更改我的sql表结构,使其具有一个主键和一个具有增量性质或时间戳的列属性.

3.Change my sql table structure to have one primary key and one column property with incremental nature or timestamp.

这篇关于kafka-connect-jdbc:SQLException:仅在使用分布式模式时没有合适的驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Simulating MySQL#39;s ORDER BY FIELD() in Postgresql(在 Postgresql 中模拟 MySQL 的 ORDER BY FIELD())
Using MySQL query to traverse rows to make a recursive tree(使用MySQL查询遍历行制作递归树)
MySQL LOAD DATA INFILE with ON DUPLICATE KEY UPDATE(MySQL LOAD DATA INFILE 和 ON DUPLICATE KEY UPDATE)
Search for quot;whole word matchquot; in MySQL(搜索“全字匹配在 MySQL 中)
add column to mysql table if it does not exist(如果不存在,则将列添加到 mysql 表)
MIN/MAX vs ORDER BY and LIMIT(MIN/MAX 与 ORDER BY 和 LIMIT)