A Kafka Connect cluster is one or more workers running in Distributed Mode with the same group.id. The workers coordinate through Kafka topics and distribute connector tasks among themselves, allowing external systems to exchange data with Kafka without placing all work on one process. section 11.2 section 11.3
A cluster provides several operational benefits:
- Adding workers with the same group.id increases available capacity; Kafka Connect redistributes tasks across them. section 11.3
- If a worker crashes, the remaining workers redistribute its tasks. section 11.3
- Multiple connectors can run simultaneously, such as importing database data while writing to a third-party system. section 11.3
- Tasks run independently and can process partitions or other units of connector work in parallel. section 11.2.1
bootstrap.servers=localhost:9092 group.id=connect config.storage.topic=connect-config offset.storage.topic=connect-offset status.storage.topic=connect-status key.converter=org.apache.kafka.connect.storage.StringConverter value.converter=org.apache.kafka.connect.storage.StringConverter plugin.path=<PATH-TO-YOUR-USER-DIRECTORY>/kafka/libs/
A Distributed Mode worker configuration identifies the Kafka cluster, worker group, internal configuration topics, offset topics, status topics, converters, and plugin path. section 11.2.1
Scaling database imports
Suppose a connector imports 12 database tables and tasks.max is 4. Kafka Connect creates four independent tasks, each responsible for three tables, then distributes those tasks across workers. Adding another worker with the same group.id lets the cluster rebalance the workload. For production deployments, use connectors whose source data is available to every worker; the local-disk FileStreamSource connector is unsuitable for production because files may not exist on other workers. section 11.3
$ connect-distributed.sh worker.properties
Start a configured Distributed Mode worker with connect-distributed.sh and worker.properties; Kafka Connect exposes configuration and monitoring through its REST API, normally on port 8083. section 11.2.1 section 11.5.1
