0

当我运行我的 kafka 连接作业时,我收到以下错误

[2017-04-25 14:56:22,806] ERROR Failed to create job for ./etc/kafka-connect-jdbc/sqlserver.properties (org.apache.kafka.connect.cli.ConnectStandalone:88)
[2017-04-25 14:56:22,808] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:99)
java.util.concurrent.ExecutionException: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: Connector configuration is invalid (use the endpoint `/{connectorType}/config/validate` to get a full list of errors)
    at org.apache.kafka.connect.util.ConvertingFutureCallback.result(ConvertingFutureCallback.java:80)
    at org.apache.kafka.connect.util.ConvertingFutureCallback.get(ConvertingFutureCallback.java:67)
    at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:96)
Caused by: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: 
Connector configuration is invalid (use the endpoint `/{connectorType}/config/validate` to get a full list of errors)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:161)
    at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:93)

我的属性文件是

name=test-sqlserver-jdbc-autoincrement
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1
connection.url=jdbc:sqlserver://192.168.9.142:1433;databaseName=postilion;user=elasticsearch;password=elasticsearch
query=select convert(varchar(10), date_time, 120) as date,convert(char(12), 
date_time, 114) as time, * from support_notifications
mode=timestamp+incrementing
timestamp.column.name=date_time
incrementing.column.name=event_nr
topic.prefix=test-events

我尝试使用GET调用 kafka 连接(在它崩溃之前)curl http://localhost:8083 /JdbcSourceConnector/config/validate,我得到了响应{"version":"0.10.2.0-cp1","commit":"64c9b42f3319cdc9"}curl: (3) <url> malformed。任何想法我做错了什么,因为这项工作在 kafka 0.9 中工作。

4

1 回答 1

0

于是我找到了出路。我最终在属性文件中将模式时间戳+递增更改为递增,并删除了行timestamp.column.name=date_time。属性文件现在看起来像这样

name=test-sqlserver-jdbc-autoincrement
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1
connection.url=jdbc:sqlserver://192.168.9.142:1433;databaseName=postilion;user=elasticsearch;password=elasticsearch
query=select convert(varchar(10), date_time, 120) as date,convert(char(12), date_time, 114) as time, * from support_notifications
mode=incrementing
incrementing.column.name=event_nr
topic.prefix=postilion-events
于 2017-04-26T06:39:24.780 回答