Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Kafka Kafka Server Start Script

From Leeroopedia


Knowledge Sources
Domains Operations, Server_Administration
Last Updated 2026-02-09 12:00 GMT

Overview

Concrete tool for starting a Kafka broker process provided by the Kafka bin scripts.

Description

The kafka-server-start.sh script is the standard entry point for starting a Kafka broker. It validates that a properties file is provided, sets default environment variables for logging and heap memory, processes the -daemon flag, and delegates to kafka-run-class.sh with the kafka.Kafka main class.

Usage

Use this script directly from the command line or from deployment automation. It requires a server.properties configuration file as its primary argument.

Code Reference

Source Location

  • Repository: Apache Kafka
  • File: bin/kafka-server-start.sh
  • Lines: L17-44

Signature

# Usage: kafka-server-start.sh [-daemon] server.properties [--override property=value]*

# Environment defaults set by this script:
# KAFKA_LOG4J_OPTS="-Dlog4j.configurationFile=file:$base_dir/config/log4j2.yaml"
# KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
# EXTRA_ARGS="-name kafkaServer -loggc"

# Delegates to:
exec $(dirname $0)/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "$@"

Import

# Direct CLI usage:
bin/kafka-server-start.sh config/server.properties

I/O Contract

Inputs

Name Type Required Description
server.properties file Yes Kafka broker configuration file
-daemon flag No Run broker in background mode
--override key=value No Override specific config properties

Outputs

Name Type Description
Kafka process JVM process Running Kafka broker (foreground or daemon)
Logs file Written to configured Log4j2 directory

Usage Examples

Start Broker in Foreground

bin/kafka-server-start.sh config/server.properties

Start Broker as Daemon

bin/kafka-server-start.sh -daemon config/server.properties

Start with Config Overrides

bin/kafka-server-start.sh config/server.properties \
  --override broker.id=1 \
  --override log.dirs=/data/kafka-logs

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment