Implementation:Apache Kafka Connect Standalone Script
| Knowledge Sources | |
|---|---|
| Domains | Kafka_Connect, CLI |
| Last Updated | 2026-02-09 12:00 GMT |
Overview
External Tool Doc for launching Kafka Connect in standalone mode via the connect-standalone.sh shell script.
Description
The connect-standalone.sh script is the entry point for running Kafka Connect in standalone mode. It is a shell wrapper that configures Log4j2 logging defaults, JVM heap settings, and process naming before delegating to kafka-run-class.sh to launch the org.apache.kafka.connect.cli.ConnectStandalone Java class. Standalone mode runs a single Connect worker process where all connectors and tasks execute locally without distributed coordination.
Usage
Use this script to start a Kafka Connect worker in standalone mode for development, testing, or simple single-node deployments where distributed coordination across multiple workers is not required. Connector configuration files are passed as additional arguments after the worker properties file.
Code Reference
Source Location
- Repository: Apache_Kafka
- File: bin/connect-standalone.sh
- Lines: 1-45
Signature
#!/bin/bash
# Usage: connect-standalone.sh [-daemon] connect-standalone.properties [connector1.properties connector2.json ...]
# Environment variables:
# KAFKA_LOG4J_OPTS - Log4j2 configuration (default: -Dlog4j2.configurationFile=.../config/connect-log4j2.yaml)
# KAFKA_HEAP_OPTS - JVM heap settings (default: -Xms256M -Xmx2G)
# EXTRA_ARGS - Additional arguments for kafka-run-class.sh
# Delegates to:
exec kafka-run-class.sh $EXTRA_ARGS org.apache.kafka.connect.cli.ConnectStandalone "$@"
Import
# No import required; invoke directly from the Kafka installation bin/ directory:
bin/connect-standalone.sh connect-standalone.properties connector1.properties
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| properties_file | File path | Yes | Path to the Connect standalone worker configuration file (e.g., connect-standalone.properties) |
| connector_configs | File paths | No | One or more connector configuration files (.properties or .json) to load at startup |
| -daemon | Flag | No | Run the Connect worker as a background daemon process |
| KAFKA_LOG4J_OPTS | Env var | No | Custom Log4j2 configuration; defaults to connect-log4j2.yaml |
| KAFKA_HEAP_OPTS | Env var | No | JVM heap settings; defaults to -Xms256M -Xmx2G |
Outputs
| Name | Type | Description |
|---|---|---|
| Connect worker process | JVM process | A running Kafka Connect standalone worker executing all configured connectors locally |
| Log files | Files | Log output as configured by Log4j2 (connect-log4j2.yaml) |
Usage Examples
Start Connect in Standalone Mode
# Start a standalone Connect worker with one connector
bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties
Multiple Connectors
# Start with multiple connector configurations
bin/connect-standalone.sh config/connect-standalone.properties \
config/connect-file-source.properties \
config/connect-file-sink.properties
Start as Daemon
# Start standalone Connect worker in the background
bin/connect-standalone.sh -daemon config/connect-standalone.properties config/connect-file-source.properties