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
- 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
kafkaor similar. - Go to the config directory: inside the installation directory, the
configsubdirectory holdsserver.properties.
- Open
server.propertiesin any text editor to view or change settings.
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 Key | Description | Default Value | Note |
broker.id | Unique identifier for a broker within the cluster | Auto-generated (0) | Must be unique if set manually |
listeners | Listener interfaces for network connections | PLAINTEXT://:9092 | Modify if using SSL or if binding to a specific IP |
log.dirs | Directories where logs are stored | /tmp/kafka-logs | Usually changed to a persistent storage location |
zookeeper.connect | Zookeeper connection string | localhost:2181 | Must be modified to point to the Zookeeper cluster |
Editing the config safely
- Back up the configuration file before changing it.
- Understand the impact of each change; consult the Kafka documentation or community resources.
- Restart the broker or client afterwards so the changes take effect.
For example, to change the default number of log partitions, set:
Change the number to the partition count you want.
Related reading
- How can I force a RabbitMQ broker to NACK a message for testing?
- How can i get all group list with kafka0.10.x
- How can I get the group.id of a topic in command line in Kafka?
- How can I get the offset value in KStream
- How can I gracefully handle a Kafka outage?
- How can I handle IOException when Kafka is down?
- How can I initialize kafka ConsumerRecords<String,String> in kafka for testing
- How can I instantiate a Mock Kafka Topic for junit tests?
System design interview problems on this topic
- Design a Distributed Messaging System: solution and walkthrough
- Design a Log Collection and Analysis System: solution and walkthrough
- Design an Ad Click Aggregation System: solution and walkthrough
- Design a Webhook Notification Service: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.