Kafka Connect: Connector Configuration and Tasks

Kafka Connect: Connector Configuration and Tasks

A beginner-friendly guide to how a connector is described, how it splits its work into tasks, and how Kafka Connect runs, scales, recovers and monitors them, all without writing an application.

Imagine a large factory with a manager and a team of workers. The manager receives a written order: “Move all the boxes from warehouse A to warehouse B, and use up to five workers.” The manager does not carry boxes personally. Instead, the manager studies the order, divides the boxes into fair piles, and hands one pile to each worker. If a worker falls sick, the manager gives that pile to someone else. Kafka Connect works in almost exactly this way. The written order is the connector configuration, the manager is the connector, and the workers carrying boxes are the tasks. This guide explains every part of that picture from zero, so you can follow it even if you have never used Kafka Connect before.

1The Problem Kafka Connect Solves

Almost every company needs to move data between Kafka and other systems. Doing it by hand, again and again, is wasteful.

Data lives in many places

Apache Kafka is a system that stores streams of messages, called records, in named channels called topics. But a company’s data does not start in Kafka. It starts in databases, log files, cloud storage, search engines, messaging systems and business applications. To make use of Kafka, you must bring data in from those places, and often push data back out to them again.

The hand-written way

You could write a custom program for each system: one that reads rows from a database and produces Kafka records, another that consumes records and writes them to cloud storage. Each program would need code for connecting, retrying after failures, remembering where it stopped, scaling to more machines, handling bad records and reporting its health. Every team would solve those same problems again, in slightly different and slightly buggy ways.

Simple Analogy

Writing a custom data-moving program for every system is like building a new truck every time you want to deliver a parcel. Kafka Connect is a ready-made delivery fleet: you only fill in the delivery form, and the fleet takes care of the driving, the fuel and the breakdowns.

What Kafka Connect is

Kafka Connect is a framework that ships as part of Apache Kafka. It runs as its own service, separate from the Kafka brokers, and its job is to move data between Kafka and other systems using reusable plug-ins called connectors. You do not write code for the common cases. You describe what you want in a configuration, submit it, and Kafka Connect does the rest. It also looks after scaling, fault tolerance, offset tracking and monitoring for you.

i
Remember

Kafka Connect is configuration-driven. The two most important ideas in this guide, the connector configuration and the task, are exactly what let you steer it without programming.

2The Big Picture: Workers, Connectors and Tasks

Three words appear everywhere in Kafka Connect, and they are easy to confuse. Let us separate them clearly.

Term 1

Worker

A running Kafka Connect process, the actual machine or container that does the work. Several workers can join together into a cluster.

Term 2

Connector

A named job defined by a configuration. It decides how the work is split, but it does not move the data itself.

Term 3

Task

The unit that really moves data. Each connector creates one or more tasks, and the tasks run on the workers.

Term 4

Plug-in

The packaged code (a connector class and its tasks) that knows how to talk to one specific system such as a database or a file store.

Simple Analogy

A worker is a delivery van with a driver. A connector is the delivery order that says what to deliver and where. A task is one specific delivery run assigned to a van. One order can turn into several runs, and the runs may be spread across many vans.

flowchart TD
    subgraph Cluster[Kafka Connect Cluster]
        W1[Worker 1]
        W2[Worker 2]
        W3[Worker 3]
    end
    CFG[Connector configuration] --> CON[Connector instance]
    CON --> T1[Task 0]
    CON --> T2[Task 1]
    CON --> T3[Task 2]
    T1 --> W1
    T2 --> W2
    T3 --> W3
    T1 --> K[(Kafka topics)]
    T2 --> K
    T3 --> K
        
FIG 1 — One connector configuration produces several tasks that run across the workers

Source and sink connectors

Connectors come in two directions. A source connector pulls data from an outside system and writes it into Kafka topics. A sink connector reads records from Kafka topics and writes them into an outside system. The word “task” applies equally to both: a source task reads from the outside world and produces records, while a sink task consumes records and delivers them outward.

Source example

A connector that watches a database and turns every new row or change into a Kafka record, so that other applications can react to database changes in real time.

Sink example

A connector that reads records from a Kafka topic and stores them as files in cloud storage, or indexes them into a search engine for fast lookups.

!
Common Misconception

Beginners often think “the connector moves the data.” In truth, the connector is only the planner. The tasks do the moving. This distinction explains almost every question about scaling and failures later in this guide.

3The Two Ways to Run Kafka Connect

Workers can run alone for simple jobs, or together for real production systems.

Standalone mode

In standalone mode, a single worker process runs all connectors and tasks. Its settings and the connector settings are supplied as files when the process starts. Offsets, which record how far the connector has progressed, are kept in a local file. This mode is easy to start and good for learning, testing and small, single-machine jobs. Its weakness is obvious: if the machine dies, everything stops, and nothing takes over automatically.

Distributed mode

In distributed mode, many workers join into one cluster. They find each other through Kafka itself, using a shared group identifier. Connector configurations are submitted through a web interface and stored safely inside Kafka topics. If a worker disappears, its tasks are handed to the remaining workers, and if you add a worker, the cluster spreads the load onto it. Production systems almost always use this mode.

AspectStandaloneDistributed
Number of workersOneMany, forming a cluster
Connector settings supplied byFiles at startupThe REST interface, stored in Kafka
Offsets stored inA local fileA Kafka topic (source) or consumer group (sink)
Fault toleranceNone if the machine failsTasks move to healthy workers
ScalingLimited to one processAdd workers and raise task limits
Best forLearning, testing, tiny jobsProduction workloads
Simple Analogy

Standalone mode is a one-person shop: fast to open, but if the owner is ill, the shop closes. Distributed mode is a shop with a team: the work is shared, and colleagues cover for each other.

Where distributed mode keeps its memory

A distributed cluster stores three kinds of information in Kafka topics, so that no single worker holds the only copy. One topic holds the connector and task configurations. One holds the offsets of source connectors. One holds the current status of connectors and tasks. Because these topics live in Kafka, they are replicated and durable, and a newly started worker can rebuild its knowledge simply by reading them.

Internal topic

Config storage

Remembers every connector’s configuration and its task configurations.

Internal topic

Offset storage

Remembers how far each source connector has read, such as the last processed position in a system.

Internal topic

Status storage

Remembers whether each connector and task is running, paused or failed.

i
Good Practice

Give these internal topics a proper replication factor in production. If they are lost or under-replicated, the cluster can forget its connectors and positions.

4What Is a Connector Configuration?

The configuration is the written order. It tells Kafka Connect what to run, where to read, where to write and how to behave.

A configuration is a set of named settings

A connector configuration is simply a collection of key and value pairs, where each key is a setting name and each value is your choice. In distributed mode you send it to the cluster as a small JSON document through the REST interface. In standalone mode you place it in a properties file. Either way, it contains the same kinds of settings, and Kafka Connect reads them to create the connector.

Simple Analogy

A connector configuration is like a filled-in order form at a courier office. It has boxes for the sender, the receiver, the size of the parcel and any special handling. Once the clerk has the form, no more explanation is needed.

Two layers of settings

Beginners often mix up two different sets of settings, so it helps to name them clearly.

Worker configuration

Settings for the Kafka Connect process itself: which Kafka brokers to use, where the plug-ins live, which converters to use by default, and where internal topics are stored. It is set once when a worker starts and applies to everything on that worker.

Connector configuration

Settings for one specific job: which connector class to use, how many tasks at most, which topics to read or write, and every detail of the external system. You can have many connectors, each with its own configuration, running on the same cluster.

flowchart LR
    WC[Worker configuration] --> D[Defaults for all connectors]
    CC[Connector configuration] --> O[Settings for one job]
    D --> R[Effective behaviour of a task]
    O --> R
        
FIG 2 — Worker defaults and connector settings combine to shape a task’s behaviour
!
Common Mistake

Editing the worker configuration file when you really meant to change one connector. Worker settings need a restart of the worker, while connector settings can be updated live through the REST interface.

5The Core Settings Every Connector Has

No matter which system you connect to, a handful of settings appear in almost every connector configuration.

Required

name

A unique name for the connector within the cluster. It identifies the job in the REST interface, in logs and in metrics.

Required

connector.class

The plug-in class that knows how to talk to the external system. It picks which connector implementation runs.

Common

tasks.max

The maximum number of tasks the connector may create. It is an upper limit, not a promise.

Sink

topics or topics.regex

Which Kafka topics a sink connector reads from, given as a list or as a name pattern.

Data format

key.converter and value.converter

How record keys and values are turned into bytes and back, for example as JSON or Avro.

Optional

transforms

A list of small changes to apply to each record on its way through, such as renaming a field or adding a timestamp.

Connector-specific settings

Beyond the shared settings, each connector defines its own. A database connector will ask for the database address, the user name, which tables to include and how often to check for new data. A cloud storage connector will ask for the bucket name, the file format and how large each file should be. These settings are documented by the connector’s authors, and they are the part of the configuration where you will spend most of your time.

Validation before you start

Kafka Connect can check a proposed configuration before running it. Each connector describes its own settings, including which are required, what type each has, and what values are allowed. A validation request returns a list of problems, so you can fix mistakes before creating the connector. This saves the frustration of a job that fails moments after you submit it.

i
Practical Tip

Make validation a step in your deployment pipeline. A configuration that passes validation may still fail to connect, but it will not fail because of a typo or a missing required setting.

“A connector configuration is a promise about intent. The connector and its tasks are the effort to keep that promise.”

6What Is a Task?

A task is the smallest piece of running work in Kafka Connect. Understanding it explains scaling, failure and speed.

The manager and the workers, again

When you create a connector, Kafka Connect starts a connector instance. This instance is a coordinator. It looks at your configuration and at the external system, and decides how many pieces the work should be divided into. Each piece is described by a small set of settings called a task configuration. Kafka Connect then creates one task for each task configuration and hands them out to the workers in the cluster.

Simple Analogy

Think of a teacher dividing a big classroom cleanup. The teacher (connector) looks at the room and decides on four zones. She writes a slip for each zone (task configuration) and hands the slips to four students (tasks). The teacher does not clean; she only plans and reassigns if a student is absent.

What a task actually does

A source task

Repeatedly asks the outside system for new data, converts it into records, and hands them to the Kafka Connect runtime, which sends them to Kafka. It also reports the position it has reached, so that work can resume from there later.

A sink task

Receives batches of records that the runtime has read from Kafka, delivers them to the outside system, and confirms when they are safely written, so that progress can be recorded.

Tasks are mostly stateless

A task does not keep important information only in its own memory. Its configuration lives in Kafka, and its progress lives in offsets stored in Kafka. That is why a task can be stopped on one worker and started on another without losing its place. This design is the reason Kafka Connect can recover so smoothly from failures.

1
connector plans the work
1 to many
tasks carry out the work in parallel
Many
workers host the tasks

7tasks.max: The Setting Everyone Misunderstands

The name suggests “run this many tasks.” The truth is more subtle, and it matters.

An upper limit, not a target

The setting tasks.max tells the connector the largest number of tasks it may create. The connector itself then decides how many tasks are actually useful and returns that many task configurations. If the connector can only split its work into three pieces, setting the limit to ten will still give you three tasks. The other seven would have nothing to do, so they are never created.

How the real number is decided

1

You set the limit

You choose a maximum, based on how much parallel work you would like to allow.

2

The connector looks at the natural units of work

A database connector might count tables. A file connector might count files. A sink connector depends on the number of topic partitions being read.

3

The connector shares the units among tasks

It creates up to the limit, dividing the units as evenly as it can among the tasks.

4

The runtime starts the tasks

Kafka Connect starts exactly the number of tasks the connector described and spreads them over the workers.

Why sink connectors have a natural ceiling

A sink connector’s tasks read from Kafka the same way ordinary consumers do, and they share a consumer group. In a consumer group, each partition is read by at most one member at a time. So if a topic has six partitions, more than six sink tasks would leave the extra tasks idle. For sink connectors, the number of useful tasks is capped by the number of partitions in the topics being read.

Simple Analogy

If a restaurant has six tables, hiring ten waiters does not serve customers faster, because four waiters have no table to serve. Partitions are the tables, and tasks are the waiters.

Why some source connectors can use only one task

Some source systems cannot be read in parallel without breaking correctness. A connector that follows a single ordered change log, for example, may need one task so that changes stay in order. Such a connector will create one task even if you set a higher limit. Always read the connector’s own documentation to learn what limits its parallelism.

!
Common Mistake

Raising tasks.max to a large number, expecting a faster pipeline, and seeing no change. The bottleneck is usually the number of partitions, tables or files, or the outside system itself, not the limit.

8How Tasks Are Created and Assigned

From submitting a configuration to seeing data flow, several steps happen quickly. Let us walk through them.

sequenceDiagram
    participant U as You
    participant R as REST Interface
    participant L as Cluster Leader Worker
    participant C as Connector Instance
    participant W as Workers
    U->>R: Submit connector configuration
    R->>L: Store configuration in Kafka
    L->>C: Start connector
    C->>C: Decide how to split the work
    C-->>L: List of task configurations
    L->>W: Assign tasks to workers
    W->>W: Start tasks
    W-->>R: Report status running
        
FIG 3 — From a submitted configuration to running tasks
1

You submit the configuration

Any worker in the cluster can accept it through the REST interface. The configuration is validated and written to the config topic in Kafka.

2

The cluster notices the new connector

All workers read the config topic. A change there causes the group to coordinate and assign the new connector to one worker.

3

The connector instance starts and plans

The worker holding the connector starts it and asks it for its task configurations, using your limit as the maximum.

4

Task configurations are stored

The planned task configurations are also stored in the config topic, so every worker knows which tasks exist.

5

Tasks are handed to workers

The cluster balances the tasks across available workers, trying to keep the load even.

6

Tasks start moving data

Each task connects to the outside system or to Kafka and begins its work, reporting its status back to the cluster.

The connector watches for change

The connector instance stays alive after planning. It can watch the external system for changes that require a new plan. For example, if a new table appears in a database, the connector can ask the runtime to re-plan its tasks so that the new table is covered. This is called a task reconfiguration, and it is one way Kafka Connect adapts to a changing world without you touching anything.

i
Good to Know

A reconfiguration means old tasks are stopped and new ones started, so brief pauses are normal. Progress is not lost, because offsets are stored safely outside the tasks.

9Offsets: How Tasks Remember Where They Stopped

Restarting without losing or repeating work depends on remembering progress. Source and sink tasks do this differently.

Source offsets

A source task describes its position in the outside system in its own words, for instance “file name plus line number” or “database change log position.” The Kafka Connect runtime stores these source offsets in the offset topic, and hands them back to the task when it restarts, so the task can continue right after the last confirmed position.

Sink offsets

A sink task reads from Kafka, so its progress is simply a normal consumer position: how far it has read in each partition. These positions are stored in Kafka as consumer group offsets, under a group named after the connector. Kafka Connect only commits them once the sink task has confirmed that the records were written, which is what allows safe recovery.

AspectSource ConnectorSink Connector
Position described asWhatever fits the outside systemTopic, partition and offset in Kafka
Stored inThe Connect offset topicConsumer group offsets in Kafka
Committed whenRecords are safely handed to KafkaRecords are confirmed written outward
Resumes fromThe last stored source positionThe last committed Kafka offset
Simple Analogy

Offsets are bookmarks. A source task keeps a bookmark in someone else’s book, described in that book’s own terms. A sink task keeps a bookmark in Kafka’s book, using page numbers.

Delivery guarantees in plain words

By default, Kafka Connect gives at-least-once delivery. If a task fails after writing some data but before recording its progress, the work between the last saved position and the failure point may be done again after recovery. Duplicates are therefore possible, so the receiving system should be able to tolerate them, for example by using unique keys so that a repeated write simply overwrites itself. Newer versions add stronger options for certain connectors, but availability depends on the version and on the specific connector.

!
Common Mistake

Assuming that a connector never produces duplicates. Design the destination to accept repeated records safely, and check the documentation of your connector for its exact guarantees.

10Converters and Transforms: Shaping Data in Flight

Connectors read and write in the outside system’s language. Converters and transforms translate to and from Kafka’s world.

Converters

A converter changes data between Kafka Connect’s internal representation and the bytes stored in Kafka. There is one for keys and one for values, chosen with the settings key.converter and value.converter. Typical choices include plain text, JSON, and formats that work with a schema registry such as Avro or Protobuf. The converter is not part of the connector plug-in, so you can use the same connector with different data formats just by changing this setting.

Simple Analogy

A converter is a language interpreter at a border. The connector speaks the local language of its system. Kafka expects a shared language for its records. The interpreter sits between them and translates in both directions.

Single Message Transforms

A Single Message Transform, often shortened to SMT, is a small step that changes one record at a time as it passes through the connector. You list the ones you want, in order, in the configuration. Common uses include renaming fields, removing sensitive fields, adding a timestamp, changing the topic a record is sent to, and picking out only one field.

Use

Rename or drop fields

Clean up data so consumers see only what they need.

Use

Route records

Change the destination topic based on the record content or its origin.

Use

Add metadata

Insert extra fields such as an ingestion time or a fixed label.

Use

Mask sensitive values

Hide or remove personal information before it spreads further.

Order matters

Transforms run in the order they are listed, and each one receives the result of the previous one. A transform that renames a field must therefore come before a transform that refers to the new name. Also remember that transforms work one record at a time. For anything that needs joining, counting or looking across many records, use a stream processing tool instead.

i
Practical Tip

Keep transform chains short and simple. A long chain of many transforms is hard to debug, and it usually signals that the work belongs in a proper stream processing job.

11Task Lifecycle and States

Every connector and every task has a status. Knowing what each status means makes troubleshooting far easier.

State

RUNNING

The connector or task is active and doing its work.

State

PAUSED

You asked it to stop working for a while. Its configuration and position are kept.

State

FAILED

An error stopped it. It will stay failed until you restart it, and the status includes a description of the error.

State

UNASSIGNED

It exists but has not yet been given to a worker, for example while the cluster is reorganising.

Newer versions of Kafka Connect also add more descriptive states, such as one for a connector that has been stopped with its position preserved, and one for a restart in progress. The exact list depends on your version, so it is worth confirming in the documentation of the version you run.

flowchart LR
    A[UNASSIGNED] --> B[RUNNING]
    B --> C[PAUSED]
    C --> B
    B --> D[FAILED]
    D --> B
        
FIG 4 — The common states of a task and how it moves between them

Connector state versus task state

A connector and its tasks have separate states. A connector can be running while one of its tasks has failed. This surprises many beginners: the top-level status looks healthy, yet data is no longer flowing for part of the work. Always look at both the connector status and the status of each task.

!
Common Mistake

Checking only the connector’s top-level status and concluding that everything is fine. A failed task will not restart itself, so always inspect each task’s state.

12Rebalancing: What Happens When Workers Come and Go

In a distributed cluster, the assignment of connectors and tasks to workers is not fixed. It adjusts as the cluster changes.

Why rebalancing happens

Workers form a group, much like consumers do. Whenever a worker joins, leaves or crashes, or whenever a connector is added, removed or reconfigured, the group performs a rebalance. During a rebalance, the cluster decides again which worker should run which connectors and tasks, so that the load stays even and nothing is left without a home.

Simple Analogy

Picture a group of friends sharing household chores. When a new friend moves in, the chores are redistributed. When someone leaves, their chores are handed to the others. Rebalancing is that redistribution, done automatically.

flowchart TD
    A[Worker 2 crashes] --> B[Group notices missing member]
    B --> C[Rebalance starts]
    C --> D[Leader recomputes assignment]
    D --> E[Tasks from Worker 2 given to Worker 1 and Worker 3]
    E --> F[Tasks resume from stored offsets]
        
FIG 5 — How the cluster recovers when a worker disappears

Eager and cooperative rebalancing

In older versions, a rebalance was “stop the world”: every task on every worker was stopped, assignments were recomputed, and everything restarted. This caused a noticeable pause for all connectors even when only one thing had changed. Modern versions use incremental cooperative rebalancing. Only the tasks that actually need to move are stopped and restarted, while the rest keep running. This greatly reduces the disruption of routine cluster changes.

Cooperative approach

  • Only affected tasks pause
  • Other connectors keep running smoothly
  • Better for large clusters with many connectors
  • Gives a short grace period for a returning worker

Eager approach

  • Every task stops during the change
  • Visible delays across all connectors
  • Simpler logic but more disruptive
  • Mostly found in older versions

The grace period for returning workers

If a worker disappears briefly, for example during a quick restart, moving all its tasks elsewhere and then moving them back would be wasteful. The cluster therefore waits for a short, configurable delay before reassigning the work of a missing worker. If the worker comes back within that time, it simply resumes its tasks. This delay is a trade-off: a longer wait avoids needless movement, while a shorter wait recovers faster from permanent failures.

i
Practical Tip

During planned maintenance, restart workers one at a time and wait for the cluster to settle between them. Rolling restarts with the grace period in mind avoid unnecessary task movements.

13Scaling Connectors and Tasks

When data volume grows, you need more throughput. There are three levers, and they work together.

Lever 1

More tasks

Raise tasks.max so the connector may split its work into more parallel pieces, if the connector and data allow it.

Lever 2

More workers

Add workers to the cluster so that tasks have more machines and processors to run on.

Lever 3

More partitions or sources

Give the work more natural pieces to divide: more topic partitions for sinks, more tables or files for sources.

The right order of thinking

1

Find the real bottleneck

Look at whether the tasks, the workers, Kafka or the outside system is the slowest part. Scaling the wrong part changes nothing.

2

Check the parallelism ceiling

Confirm how many pieces the connector can create. For a sink, count partitions. For a source, count tables, files or shards.

3

Raise tasks.max within that ceiling

Increase gradually and watch the metrics, rather than jumping to a large number.

4

Add workers if the machines are busy

If existing workers are short of processor or memory, more tasks on the same machines will not help. Add machines.

5

Protect the outside system

More tasks mean more connections and more load on the database or service at the other end. Make sure it can cope.

Simple Analogy

Scaling a delivery service needs vans (workers), drivers with routes (tasks) and enough parcels in separate bundles (partitions or tables). If the warehouse door is narrow (the outside system), adding more vans only creates a queue at the door.

!
Common Mistake

Scaling Kafka Connect until the source database becomes overloaded. Always treat the external system as part of the capacity plan.

14Error Handling, Retries and Dead Letter Queues

Real data is messy. A good configuration decides in advance what happens when a record cannot be processed.

Where errors can occur

Kafka Connect can meet trouble at several points: while converting a record, while running a transform, or inside the connector’s own logic when talking to the outside system. Some of these errors are temporary, such as a brief network glitch. Others are permanent, such as a record that simply cannot be understood. The two need different treatment.

Key error settings

Setting

errors.tolerance

Decides whether the task fails immediately on a bad record, or skips it and keeps going. The strict choice stops at the first problem.

Setting

errors.retry.timeout

How long to keep retrying an operation that failed, before giving up. Useful for temporary trouble.

Setting

errors.log.enable

Whether to write details of each error to the worker log so that you can investigate.

Sink setting

Dead letter queue topic

For sink connectors, a topic name where records that could not be processed are copied, together with optional error details.

flowchart TD
    A[Record arrives at task] --> B{Processing succeeds?}
    B -- Yes --> C[Write to destination]
    B -- No --> D{Tolerance allows skipping?}
    D -- No --> E[Task fails and stops]
    D -- Yes --> F[Log the error]
    F --> G{Dead letter queue configured?}
    G -- Yes --> H[Copy bad record to dead letter topic]
    G -- No --> I[Skip record]
    H --> J[Continue with next record]
    I --> J
        
FIG 6 — How a task decides what to do with a record that fails

Strict versus tolerant

Strict: stop on the first bad record

The safest choice when every record matters, such as financial data. The task fails, you investigate, fix the cause and restart. Nothing is silently dropped, but progress halts until you act.

Tolerant: skip and record the failure

Suitable for high-volume, loss-tolerant data such as click events. Bad records are set aside in a dead letter topic, and the pipeline keeps flowing. Someone must still review the dead letters regularly.

!
Common Mistake

Turning on full tolerance and never looking at what was skipped. Without a dead letter topic or logging, records vanish silently, and nobody notices until a report is wrong.

Error handling in these settings covers problems in conversion, transforms and record delivery. It does not cover every failure. For example, if the outside system is completely unreachable, the connector’s own retry behaviour and the task failure mechanism apply instead. Read the connector’s documentation to see how it treats connection errors.

15Keeping Secrets Out of Configurations

Connector configurations often need passwords and keys. Storing them in plain text is a common and dangerous habit.

Why plain text is a problem

In distributed mode, connector configurations are stored in a Kafka topic and can be read through the REST interface. If a password sits inside the configuration in plain text, anyone who can read the configuration can read the password. It may also appear in logs, tickets and copied examples. This risk grows with every person and tool that touches the configuration.

Config providers

Kafka Connect supports config providers, small components that fetch a value from a safer place when the connector starts. Instead of writing the password itself, you write a placeholder that says “get this value from that source.” The actual secret is resolved when the task starts and is not stored in the configuration topic. Providers exist for reading from files, from folders, and from environment variables, and external secret managers can be plugged in too.

Simple Analogy

Instead of writing your house key’s shape on a note that anyone can read, you write “the key is in the safe at the front desk.” Only people with access to the safe can get the key, and the note itself reveals nothing.

1

Register a provider in the worker configuration

Tell the worker which providers are allowed and give each a short name.

2

Put placeholders in the connector configuration

Reference the provider name and the location of the secret instead of the secret itself.

3

Protect the real secret store

Restrict who can read the files, variables or secret manager that actually hold the values.

4

Rotate secrets regularly

When a secret changes, restart or refresh the connector so it picks up the new value.

i
Good Practice

Treat any connector configuration you paste into a chat, a ticket or a document as public. If it ever contained a real password, change that password.

16Tuning Behaviour: Client Overrides and Performance

Under the hood, tasks use ordinary Kafka producers and consumers. You can tune them, within limits.

Tasks use normal Kafka clients

A source task’s records are sent to Kafka by a producer that the runtime manages. A sink task’s records are read by a consumer that the runtime manages. Both clients have many settings, such as batch sizes, waiting times and buffer sizes, which decide how fast and how efficiently data moves. By default, they inherit values from the worker configuration.

Per-connector overrides

Sometimes one connector needs different client settings from the rest. Kafka Connect allows this through override settings placed inside the connector’s own configuration, using special prefixes for producer, consumer and admin clients. Whether overrides are permitted is controlled by a worker-level policy, so an administrator can allow all, some, or none of them. This prevents any single connector from changing settings that might harm the others.

GoalWhere to adjustEffect
Higher throughput for one sink connectorConsumer override for fetch and batch sizesLarger batches per poll
Compress records from one source connectorProducer override for compressionLess network and storage use
Wait longer to build bigger batchesProducer override for linger timeFewer requests, slightly higher delay
Slow destination that needs smaller batchesConnector-specific batch size settingPrevents overload and time-outs
Control how often progress is savedWorker offset commit intervalTrade-off between duplicates and overhead

The offset commit interval

Tasks do not save their progress after every record; that would be far too slow. Instead, progress is committed periodically. A shorter interval means less repeated work after a failure but more overhead. A longer interval reduces overhead but increases the amount of data that may be processed twice if a task fails. Choose based on how costly duplicates are for your destination.

i
Practical Tip

Change one tuning setting at a time and observe the metrics. Batch sizes, compression and wait times interact, and changing several at once hides which one helped.

17Managing Connectors Through the REST Interface

In distributed mode, everything you do to connectors and tasks goes through a simple web interface.

Every worker exposes a REST interface, usually on port 8083 unless changed. You can talk to any worker in the cluster, and it will pass the request to the right place. You can use command-line tools, scripts, deployment pipelines or graphical consoles to call it. Here are the everyday actions.

Action

List connectors

See the names of all connectors currently running in the cluster.

Action

Create a connector

Submit a name and a configuration to start a new connector.

Action

Update configuration

Send a new full configuration to an existing connector. Tasks are reconfigured to match.

Action

Check status

See the connector state, the state of every task and which worker each task runs on.

Action

Pause and resume

Temporarily halt a connector and its tasks without losing configuration or position, then continue later.

Action

Restart

Restart a connector, one task, or in newer versions only the failed instances.

Action

Delete

Remove a connector and stop its tasks. Source offsets may remain, depending on version and settings.

Action

List plug-ins and validate

See which connector classes are installed, and check a proposed configuration against a plug-in.

Simple Analogy

The REST interface is the front desk of the delivery service. Anyone at any counter can create an order, cancel it, pause it or ask how it is going, and the desk passes the request to the right team.

Configuration as code

Mature teams keep connector configurations in a version-controlled repository, review changes like any other code, and let an automated pipeline apply them to the cluster. This gives history, reviews, easy rollbacks and consistent settings between test and production environments. Manual edits through the interface are convenient for experiments but easy to forget and hard to reproduce.

!
Common Mistake

Leaving the REST interface open without authentication. Anyone who can reach it can create, change or delete connectors and may read their settings. Restrict it, secure it and monitor it.

18Security Considerations

Kafka Connect touches Kafka, external systems and secrets all at once, so it deserves careful protection.

Protect the REST interface

Use encrypted connections and authentication, and limit which networks can reach it. Anyone who controls this interface controls what data flows where.

Give the worker the least access it needs

The worker connects to Kafka with its own identity. Grant it only the permissions needed for its internal topics and the topics its connectors use. Some setups allow tasks to use separate identities for finer control.

Protect credentials for outside systems

Use config providers, restrict who can read secret stores, and use accounts with narrow permissions in the databases and services you connect to.

Encrypt data in transit

Use encrypted connections between workers and Kafka, and between tasks and the outside systems, especially across networks you do not fully control.

Only install trusted plug-ins

A connector plug-in is code that runs inside the worker with access to your data and credentials. Install only plug-ins from sources you trust, and keep them updated.

i
Good Practice

Mask or remove sensitive fields with a transform before they reach a topic that many teams can read. It is easier to hide data at the door than to chase it after it has spread.

19Monitoring: Seeing the Health of Connectors and Tasks

A pipeline you cannot see is a pipeline you cannot trust. Kafka Connect exposes status and metrics for both.

Status first

The simplest check is the status view from the REST interface. It shows each connector’s state, each task’s state and any error description for failed tasks. Many teams poll this regularly and raise an alert when any task is not running. Because a failed task does not restart by itself, this alert is the single most valuable one you can create.

Metrics that matter

Health

Running and paused ratios

Show how much of the time a connector or task has been running or paused. A low running ratio signals trouble.

Throughput

Record read and write rates

For sources, how fast records are polled and written to Kafka. For sinks, how fast they are read and delivered.

Latency

Batch processing time

How long a sink takes to deliver a batch. Rising values point to a slow destination.

Progress

Offset commit results

How often progress is saved, and how often saving fails or times out.

Errors

Error and skip counts

Total record errors, records skipped and records sent to the dead letter queue.

Backlog

Consumer lag for sinks

How far behind the sink’s consumer group is on each partition. Growing lag means the sink is too slow.

flowchart LR
    T[Tasks and workers] --> J[Metrics from the workers]
    T --> S[Status from the REST interface]
    J --> D[Dashboard]
    S --> D
    D --> A[Alerts on failed tasks, high lag and errors]
        
FIG 7 — Combining status and metrics into dashboards and alerts

Logs still matter

Worker logs contain the detailed stories behind failures, such as connection problems and conversion errors. When a task fails, its status includes a summary, and the logs contain the full explanation. Collect logs from all workers in one searchable place so you can follow a task even after it moves between workers.

i
Practical Tip

Include the connector name in every alert and dashboard. When many connectors share a cluster, a general message like “task failed” is far less useful than “task 2 of the orders sink failed.”

20Troubleshooting Common Problems

Most Kafka Connect problems fall into a few familiar patterns. Here is a calm way to diagnose them.

SymptomLikely causeFirst thing to check
Connector shows RUNNING but no data flowsA task has failed or the connector created no tasksThe status of each task, not only the connector
Connector cannot be createdPlug-in not installed or configuration invalidThe list of installed plug-ins and validation results
Task fails immediately on startWrong address, credentials or permissions for the outside systemThe task’s error message and worker logs
More tasks set but no speed-upPartition, table or file ceiling reachedHow many tasks were actually created
Sink lag keeps growingSlow destination or too few tasksBatch processing time and destination health
Task keeps restarting between workersFrequent rebalancing from unstable workersWorker health, memory pressure and time-outs
Duplicate records at the destinationAt-least-once delivery after a failureWhether the destination uses unique keys or upserts
Records missing at the destinationTolerance settings skipping bad recordsDead letter topic and error logs

A calm checklist

1

Read the status and error text

The task status usually names the exception. Start there before touching anything.

2

Reproduce with a small configuration

Reduce the connector to its essentials to see whether a particular setting causes the problem.

3

Check the outside system

Confirm it is reachable, that the credentials are valid and that it is not overloaded.

4

Restart the failed task, not everything

Restart only what failed, so that healthy tasks are not disturbed. Then watch whether it fails again.

5

Fix the cause, not just the symptom

A restart clears a failed state, but if the cause remains, the task will fail again. Record what you learned.

21Best Practices and Anti-Patterns

Habits that keep connectors healthy, and traps that catch teams again and again.

Good habits

1

Run in distributed mode in production

Use several workers so that failures are absorbed, and give the internal topics a safe replication factor.

2

Keep configurations in version control

Apply them through a pipeline, so every change is reviewed, recorded and repeatable.

3

Use config providers for secrets

Never keep passwords in plain text inside configurations or repositories.

4

Set tasks.max with knowledge

Base it on partitions, tables or files, and on what the outside system can handle, not on guesswork.

5

Decide on error tolerance deliberately

Choose strict or tolerant behaviour for each connector according to the value of the data, and monitor the dead letter topic.

6

Alert on failed tasks

Since failed tasks do not restart on their own, an alert is essential.

7

Design destinations to tolerate duplicates

Use unique keys or upserts so that repeated records are harmless.

Anti-patterns to avoid

ANTI-PATTERN-01 Avoid
Problem

Running production pipelines in standalone mode on a single machine because it was easy to set up during a proof of concept.

Why It’s Harmful

One machine failure stops everything, and nothing takes over. Offsets are kept in a local file that may be lost with the machine.

Correct Approach

Move to distributed mode with multiple workers and properly replicated internal topics before real workloads depend on it.

ANTI-PATTERN-02 Avoid
Problem

Putting database passwords directly into connector configurations and committing them to a shared repository.

Why It’s Harmful

Anyone with access to the repository or the REST interface can read the secret, and it lingers in history even after being removed.

Correct Approach

Use config providers with a protected secret store, and rotate any password that was ever exposed.

ANTI-PATTERN-03 Avoid
Problem

Doing heavy business logic, joins and aggregations inside a long chain of transforms.

Why It’s Harmful

Transforms handle one record at a time, are hard to test and debug, and slow down the connector. The logic becomes hidden inside a configuration file.

Correct Approach

Keep transforms light. Move real processing into a stream processing application that reads from and writes to Kafka topics.

ANTI-PATTERN-04 Avoid
Problem

Setting tasks.max very high on every connector “just in case.”

Why It’s Harmful

Extra tasks may sit idle, or, where they do run, they overload the outside system with connections and requests.

Correct Approach

Choose a number based on partitions, natural units of work and the capacity of the outside system, and adjust using measurements.

ANTI-PATTERN-05 Avoid
Problem

Ignoring failed tasks because the connector itself still reports a running state.

Why It’s Harmful

Data stops flowing for part of the work, yet no alarm rings. Gaps in data are found much later, when they are hard to repair.

Correct Approach

Monitor and alert on every task’s state, and restart failed tasks after finding the cause.

22Real-World Scenarios

Let us see how configuration and tasks play out in typical situations.

Capturing database changes into Kafka

A change-capture source connector follows a database’s change log and turns every insert, update and delete into a record. Because the log is one ordered stream, such a connector commonly runs a single task per database, and its progress is a position in the log. High availability comes from the cluster restarting that task on another worker if its worker fails.

Copying many tables with a polling source

A connector that periodically queries a database can assign different tables to different tasks. With twenty tables and a limit of five tasks, each task handles about four tables. Raising the limit to twenty gives one table per task, but adds more connections to the database.

Archiving a topic to cloud storage

A sink connector reads a topic with twelve partitions and writes files to cloud storage. With a limit of six tasks, each task reads two partitions. Adding more than twelve tasks would give no benefit. File size and time-based rotation settings control how many files are produced.

Feeding a search engine

A sink connector indexes records into a search service. The team uses record keys as document identifiers, so replays after a failure simply overwrite the same documents, and duplicates are harmless. A dead letter topic collects records that the search service rejects, for later review.

Moving files into Kafka

A file-based source connector reads new files from a directory. The natural unit of work is a file, so the number of useful tasks depends on how many files are available at the same time.

Declarative
you describe the job, Connect runs it
Resilient
tasks move between workers on failure
Scalable
more tasks and workers as data grows

23Frequently Asked Questions

Q1What is the difference between a connector and a task?

The connector is the planner defined by your configuration. It decides how to split the work. Tasks are the units that actually move data, and they run on the workers.

Q2Does tasks.max guarantee that many tasks will run?

No. It is only an upper limit. The connector decides the real number based on the natural units of work, such as tables, files or topic partitions.

Q3Why can I not use more sink tasks than the number of partitions?

Sink tasks read as a consumer group, and each partition is read by at most one member. Extra tasks beyond the partition count would stay idle.

Q4What happens if a worker crashes?

After a short grace period, the cluster rebalances and assigns the crashed worker’s tasks to other workers. Tasks resume from their stored offsets, so little or no work is lost.

Q5Will a failed task restart automatically?

Not by default. A failed task stays failed until you restart it, so monitoring and alerting on task states is very important.

Q6Can I change a connector’s configuration while it is running?

Yes, in distributed mode you can send an updated configuration through the REST interface. The tasks are reconfigured, which causes a brief pause for that connector.

Q7Where are connector configurations stored?

In distributed mode, in an internal Kafka topic used for configuration storage. In standalone mode, they come from files given at startup.

Q8Can connectors produce duplicates?

Yes. The default guarantee is at-least-once, so some work may be repeated after a failure. Design destinations to handle repeats, and check your connector’s documentation for stronger options.

Q9What is a dead letter queue in Kafka Connect?

It is a topic where a sink connector copies records that it could not process, optionally with error details, so that the pipeline can keep moving and the bad records can be reviewed later.

Q10How do I keep passwords out of my connector configuration?

Use config providers. You register a provider in the worker configuration and refer to secrets by placeholder in the connector configuration. The real values are read from a protected location when the connector starts.

Q11Should I put complex logic in transforms?

No. Transforms are meant for small, per-record changes. Use a stream processing application for joins, aggregations and heavy logic.

Q12What is the difference between standalone and distributed mode?

Standalone runs everything in a single process with local files and no failover. Distributed runs a cluster of workers that share work, store state in Kafka topics and recover from failures, and it is the standard choice for production.

24Summary and Key Takeaways

Kafka Connect lets you move data between Kafka and other systems by writing configuration instead of code. A connector configuration names the plug-in, sets limits such as the maximum number of tasks, describes the systems and topics involved, and chooses converters, transforms and error behaviour. The connector instance acts as the planner and divides the work into tasks, and the tasks, running across the workers of a cluster, do the actual moving of data. Progress is stored as offsets in Kafka, which lets tasks move between workers and recover from failures. With careful choices about limits, error handling, secrets, security and monitoring, connectors become a reliable and low-effort backbone for data integration.

Key Takeaways

  • Connector plans, tasks work — the connector decides how to split the job, and tasks carry the data.
  • Configuration is the control panel — name, connector class, task limit, topics, converters, transforms and error settings shape the behaviour.
  • tasks.max is a ceiling, not a target — the real number depends on partitions, tables, files and connector design.
  • Distributed mode is for production — it stores state in Kafka and lets tasks move between workers.
  • Offsets make recovery possible — sources store positions in the Connect offset topic, sinks use consumer group offsets, and delivery is at-least-once by default.
  • Failed tasks do not restart themselves — monitor every task’s state and alert on failures.
  • Handle errors on purpose — choose strict or tolerant behaviour and use a dead letter topic for sink connectors.
  • Protect secrets and the REST interface — use config providers, authentication and least-privilege access.