gpt4 book ai didi

mysql - 无法使用 Confluent REST API 运行 JDBC 源连接器

转载 作者:可可西里 更新时间:2023-11-01 07:06:49 24 4
gpt4 key购买 nike

我想使用 Kafka Connect REST API 运行 JDBC 源连接器。虽然独立模式使用以下属性文件可以完美运行:

name=source-mysql-test
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1

connection.url=jdbc:mysql://localhost:3306/kafka
connection.user=myuser
connection.password=mypass


table.whitelist=MY_TABLE

# Pull all rows based on timestamp
mode=timestamp
timestamp.column.name=ROWVERSION
validate.non.null=false

# The Kafka topic will be made up of this prefix, plus the table name.
topic.prefix=MYSQL-

table.types=TABLE,VIEW
poll.interval.ms=1000

我无法使用 REST API 运行连接器。这是调用:

curl -X POST -H "Content-Type: application/json" --data '{"name": "source-mysql-test", "config": {"connector.class":"io.confluent.connect.jdbc.JdbcSourceConnector", "tasks.max":"1", "connection.url":"jdbc:mysql://localhost:3306/kafka","connection.user":"myuser","connection.password":"mypass", "table.whitelist":"MY_TABLE", "mode":"timestamp", "timestamp.column.name":"ROWVERSION", "validate.non.null":"false", "topic.prefix":"MYSQL-", "table.types":"TABLE,VIEW", "poll.interval.ms":"1000" }}' http://localhost:8083/connectors

这是响应:

{
"error_code": 400,
"message": "Connector configuration is invalid and contains the following 2 error(s):\nInvalid value com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. for configuration Couldn't open connection to jdbc:mysql://localhost:3306/kafka\nInvalid value com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. for configuration Couldn't open connection to jdbc:mysql://localhost:3306/kafka\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"
}

过去,我使用 REST API 来毫无问题地运行 JDBC 接收器连接器!

以下是可用的连接器插件:

> ls /usr/share/java/kafka-connect-jdbc/
common-utils-4.1.0.jar mysql-connector-java-5.1.46.jar uber-restavro-1.0-SNAPSHOT.jar
jline-0.9.94.jar netty-3.10.5.Final.jar
kafka-connect-jdbc-4.1.0.jar postgresql-9.4-1206-jdbc41.jar zkclient-0.10.jar
log4j-1.2.17.jar slf4j-api-1.7.25.jar zookeeper-3.4.10.jar
mssql-jdbc-6.2.2.jre8.jar sqlite-jdbc-3.8.11.2.jar

最佳答案

问题似乎是 JDBC Connector 与 MySQL 8 的兼容性问题。我已将 MySQL Connector/J 从 5.1.46 升级到 8.0.11问题已经解决。

关于mysql - 无法使用 Confluent REST API 运行 JDBC 源连接器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50351956/

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