如何在另一台主机上连接kafka和mysql?

nwsw7zdq  于 2021-06-06  发布在  Kafka
关注(0)|答案(1)|浏览(449)

我的数据库位于另一个linux节点.xx.中。:3306 and 我正在从我的windows机器上运行kafka connect的独立命令。我的server.properties代码是

name=test-source-mysql-jdbc-autoincrement
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1
connection.url=jdbc:mysql://xxx.xx.xxx.xxx:3306/databasename?user=username&useSSL=false
&password=password
mode=incrementing
incrementing.column.name=columnname 
topic.prefix=mysqlname-databasename-database-

我收到以下错误

Mar 28, 2019 11:55:41 AM org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.ConnectorPluginsResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. D
ue to constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.ConnectorPluginsResource will be ignored.
Mar 28, 2019 11:55:41 AM org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to
constraint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource will be ignored.
Mar 28, 2019 11:55:41 AM org.glassfish.jersey.internal.inject.Providers checkProviderRuntime
WARNING: A provider org.apache.kafka.connect.runtime.rest.resources.RootResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constr
aint configuration problems the provider org.apache.kafka.connect.runtime.rest.resources.RootResource will be ignored.
Mar 28, 2019 11:55:41 AM org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: The (sub)resource method createConnector in org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource contains empty path annotati
on.
WARNING: The (sub)resource method listConnectors in org.apache.kafka.connect.runtime.rest.resources.ConnectorsResource contains empty path annotation.
WARNING: The (sub)resource method listConnectorPlugins in org.apache.kafka.connect.runtime.rest.resources.ConnectorPluginsResource contains empty path annotation.
WARNING: The (sub)resource method serverInfo in org.apache.kafka.connect.runtime.rest.resources.RootResource contains empty path annotation.

[2019-03-28 11:55:42,108] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone)
java.lang.IllegalArgumentException: Number of groups must be positive.
        at org.apache.kafka.connect.util.ConnectorUtils.groupPartitions(ConnectorUtils.java:41)
        at io.confluent.connect.jdbc.JdbcSourceConnector.taskConfigs(JdbcSourceConnector.java:148)
        at org.apache.kafka.connect.runtime.Worker.connectorTaskConfigs(Worker.java:305)
        at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.recomputeTaskConfigs(StandaloneHerder.java:307)
        at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.updateConnectorTasks(StandaloneHerder.java:333)
        at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:211)
        at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:107)

感谢您的帮助。

hkmswyz6

hkmswyz61#

错误 Number of groups must be positive. 指示kafka connect jdbc源未找到任何可从数据库获取的表/对象。查看您的配置,您没有指定 table.whitelist / table.blacklist 所以这就是原因。另一个原因是,如果用户未被授权从任何可用对象中进行选择。这篇文章更详细。

相关问题