Kafka
Configuration File
System Management
Data Streaming
Technical Assistance

Where is the Kafka config file? (server.properties location)

Codemia Knowledge Hub ·

The Kafka broker configuration is in server.properties, inside the config subdirectory of your Kafka installation directory. Kafka's configuration files use the properties format and set things like server ports, log locations and performance tuning options.

Finding server.properties for a broker

  1. Find the Kafka installation directory: this is where the Kafka binaries and scripts live. If you installed Kafka with a package manager or a binary distribution, it is usually a directory named kafka or similar.
  2. Go to the config directory: inside the installation directory, the config subdirectory holds server.properties.
bash
   cd /path/to/kafka/config
  1. Open server.properties in any text editor to view or change settings.
bash
   nano server.properties

Client configuration

Producers and consumers also use configuration, usually set by the developer in the application code or in external files. Location and naming vary with the application's design, but the settings follow patterns similar to the broker's.

Key settings in server.properties

  • broker.id: the broker's unique ID in the cluster.
  • listeners: addresses (host/IP and port) where Kafka listens for network requests.
  • log.dirs: where Kafka stores log files.
  • zookeeper.connect: the connection string for Zookeeper, which Kafka uses to manage cluster metadata.
Configuration KeyDescriptionDefault ValueNote
broker.idUnique identifier for a broker within the clusterAuto-generated (0)Must be unique if set manually
listenersListener interfaces for network connectionsPLAINTEXT://:9092Modify if using SSL or if binding to a specific IP
log.dirsDirectories where logs are stored/tmp/kafka-logsUsually changed to a persistent storage location
zookeeper.connectZookeeper connection stringlocalhost:2181Must be modified to point to the Zookeeper cluster

Editing the config safely

  1. Back up the configuration file before changing it.
  2. Understand the impact of each change; consult the Kafka documentation or community resources.
  3. Restart the broker or client afterwards so the changes take effect.

For example, to change the default number of log partitions, set:

properties
num.partitions=3

Change the number to the partition count you want.


Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design