未将kafka消息插入数据库

fdx2calv  于 2021-06-04  发布在  Kafka
关注(0)|答案(1)|浏览(471)

kafka消息未插入到postgresql数据库中。我可以看到消费者中的消息,但它没有被插入表中。任何建议都会有帮助。
接收器连接属性

connection.url=jdbc:postgresql://localhost:5432/postgres
user=postgres
password=xxxxxx
insert.mode=insert
table.name.format=kafka_sink_pg
pk.mode=none
pk.fields=none
auto.create=true

制作人

kafka-avro-console-producer  --broker-list localhost:9092 --topic Kafka_pg  --property value.schema='{"type":"record","name":"kafka_sink_pg","fields":[{"name":"serial_no","type":"int"},{"name":"technology", "type": "string"}, {"name":"platform", "type": "string"}]}'

信息

{"serial_no": 1, "technology": "ETL", "platform": "Informatica"}
 {"serial_no": 2, "technology": "ETL", "platform": "Talend"}

下面是日志文件中的错误消息,

[2020-08-12 03:50:09,940] INFO Kafka Connect started (org.apache.kafka.connect.runtime.Connect:57)
[2020-08-12 03:50:09,943] ERROR Failed to create job for ../config/sink-quickstart-Postgres.properties (org.apache.kafka.connect.cli.ConnectStandalone:110)
[2020-08-12 03:50:09,952] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:121)
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.JdbcSinkConnector
neekobn8

neekobn81#

错误是因为插件路径无法识别位置的jdbc驱动程序。通过在中提供插件的完整路径解决了此问题 connect-avro-standalone.properties 文件
最初的

plugin.path=share/java

更改为

plugin.path=/usr/kafka/share/java  #Provided the complete path

相关问题