我们已经成功地使用了 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:仅在使用分布式模式时没有合适的驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何有效地使用窗口函数根据 N 个先前值来决定How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函数根据
在“GROUP BY"中重用选择表达式的结果;条款reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用选择表达式的结果;条款?)
Pyspark DataFrameWriter jdbc 函数的 ignore 选项是忽略整Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函数的 ig
使用 INSERT INTO table ON DUPLICATE KEY 时出错,使用 Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 时出错,使用 for 循环数组
pyspark mysql jdbc load 调用 o23.load 时发生错误 没有合pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 调用 o23.load 时发生错误 没有合适的
如何将 Apache Spark 与 MySQL 集成以将数据库表作为How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何将 Apache Spark 与 MySQL 集成以将数据库表作为