# Kafka configuration parameters

In 
Published 2022-12-03

This tutorial explains you Kafka main configuration parameters.

# Where can I find the Kafka configuration parameters ?

Kafka configuration parameters are kept in $KAFKA_HOME/config/server.properties. In my examples, $KAFKA_HOME=/kafka/kafka_2.13-2.8.0.

# Which are the most important Kafka configuration parameters ?

Take a look at the image below:

These are the main Kafka configuration parameters.

This file must be adapted for each Kafka server (the parameters which must modified for each server are marked in the image above).

In order to get this text easily, I will add the image content below:

# This is the unique id of each broker (myid)
broker.id=1

# Set to the external address (host/IP) so that clients can correctly connect to it
advertised.listeners=PLAINTEXT://kafka1:9092

# Switch to enable topic deletion or not, default value is false
delete.topic.enable=true

# A comma seperated list of directories under which to store log files
log.dirs=/kafka/kafka_2.13-2.8.0/data/kafka

# The default number of log partitions per topic.
num.partitions=8

# we will have 3 brokers so the default replication factor could be 2 or 3
default.replication.factor=2

# number of ISR to have in order to minimize data loss
min.insync.replicas=2

# this will delete data after a week
log.retention.hours=168

# The maximum size of a log segment file (when this size is reached a new log segment will be created)
log.segment.bytes=1073741824

# The interval at which log segments are checked to see if they can
# be deleted according to the retention policies
log.retention.check.interval.ms=300000

# Zookeeper connection string (Kafka server needs to be connected to Zookeeper server)
zookeeper.connect=zookeeper1:2181,zookeeper2:2181,zookeeper3:2181/kafka

# Timeout in ms for connecting to zookeeper
zookeeper.connection.timeout.ms=6000

#(by default) Kafka will create topics automatically when you send messages to non-existing topics.
# In production it is better to set it to false
auto.create.topics.enable=true