简体   繁体   中英

How to connect kafka with MySQL on another Host?

My database is in another Linux node lets suppose xxx.xx.xxx.xxx:3306 and I am running the standalone command of kafka connect from my Windows machine. My server.properties code is

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- 

I am Receiving the following error

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)

Any help is appreciated.

The error Number of groups must be positive. indicates that Kafka Connect JDBC source has not found any tables/objects to fetch from the database. Looking at your config, you've not specified table.whitelist / table.blacklist so that could be why. Another reason would be if the user is not authorised to select from any of the available objects. This article goes into more detail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM