我正在尝试将数据从Kafka avro主题中提取到我之前创建的现有Oracle数据库表中。 我以分布式模式运行Kafka Connect(3名工作人员)。 当我通过REST提交新连接器时,它会创建一个连接器,一个新任务,但任务立即失败。 无法理解为什么?以下是任务错误和我的配置。
任务错误
{"state":"FAILED","trace":"org.apache.kafka.connect.errors.ConnectException: Exiting WorkerSinkTask due to unrecoverable exception.
at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:457)
at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:251)
at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:180)
at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:148)
at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:146)
at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:190)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)","id":0,"worker_id":"kafka_host02:8083"}
Kafka Connect配置
bootstrap.servers=kafka_host01:9092,kafka_host02:9092,kafka_host03:9092
group.id=connect-cluster-00
key.converter=io.confluent.connect.avro.AvroConverter
key.converter.schema.registry.url=http://kafka_host01:8081
value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schema.registry.url=http://kafka_host01:8081
key.converter.schemas.enable=true
value.converter.schemas.enable=true
internal.key.converter=org.apache.kafka.connect.json.JsonConverter
internal.value.converter=org.apache.kafka.connect.json.JsonConverter
internal.key.converter.schemas.enable=false
internal.value.converter.schemas.enable=false
offset.storage.topic=connect-offsets
offset.storage.replication.factor=3
config.storage.topic=connect-configs
config.storage.replication.factor=3
status.storage.topic=connect-status
status.storage.replication.factor=3
offset.flush.interval.ms=10000
rest.port=8083
连接器提交命令
curl -X POST -H "Content-Type: application/json" --data '{"name": "heat-predict-ora-sink", "config": {"connector.class":"io.confluent.connect.jdbc.JdbcSinkConnector", "tasks.max":"1", "topics":"MY-TEST-02_topic", "connection.user":"scott", "connection.password":"tiger", "connection.url":"jdbc:oracle:thin:@orahost.localdomain:1521:orcl", "key.converter":"io.confluent.connect.avro.AvroConverter", "key.converter.schema.registry.url":"http://localhost:8081", "value.converter":"io.confluent.connect.avro.AvroConverter", "value.converter.schema.registry.url":"http://localhost:8081", "insert.mode":"insert", "batch.size":"0", "table.name.format":"TEST.MY_TABLE_IN", "pk.mode":"none", "pk.fields":"none" }}' http://localhost:8083/connectors
请告诉我为什么会出现这种情况?
答案 0 :(得分:1)
基于https://github.com/confluentinc/kafka-connect-jdbc/issues/221我建议您作为要写入数据的Schema的用户连接到Oracle,而不是指定schema.table
答案 1 :(得分:0)
当我允许Kafka Connect用户在自己的架构中自动创建表时,最后设法写入RDBMS。奇怪的是,新表中的字段名称是引号,但它不是一个塞子。谢谢所有试图帮助解决问题的人!