Kafka Server Properties Configuration

Kafka provide server level properties for configuration of  Broker, Socket, Zookeeper, Buffering, Retention etc.

broker.id :  This broker id which is unique integer value in Kafka cluster.


Socket Server Settings :

listeners: default value is PLAINTEXT://:9092  where socket servers listens and if not configured will take from java.net.InetAddress.getCanonicalHostName()

Format: security_protocol://host_name:port


advertised.listeners: Need to set this value if listeners value is not set. Broker will advertise this listener value to producers and consumers.

Example: PLAINTEXT://your.host.name:9092


num.network.threads: Threads handling network requests.


num.io.threads: Number of threads handling I/O for disk.


socket.send.buffer.bytes: Buffer size used by socket server to keep records for sending.


socket.receive.buffer.bytes: Buffer size used by socket server to keep records for sending.


socket.request.max.bytes: max size of request that the socket server will accept.


Log Basics

log.dirs: a comma separated list of directories under which to store log files.


num.partitions: The default number of logs per topic. More partitions allow greater parallelism for consumption, but this will also result in more files across the brokers.


num.recovery.threads.per.data.dir: The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.This value is recommended to be increased for installations with data dirs located in RAID array.


Log Flush Policy

log.flush.interval.messages:  Messages are immediately written to the file system but by default we only fsync() to sync the OS cache lazily. The following configurations control the flush of data to disk.There are a few important trade-offs here:

  1. Durability: Unflushed data may be lost if you are not using replication.
  2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.
  3.  Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks.

The settings below allow one to configure the flush policy to flush data after a period of time or every N messages (or both). This can be done globally and overridden on a per-topic basis.

The number of messages to accept before forcing a flush of data to disk.


The maximum amount of time a message can sit in a log before we force a flush.


Log Retention Policy

The following configurations control the disposal of log segments. The policy can be set to delete segments after a period of time, or after a given size has accumulated. A segment will be deleted whenever either of these criteria are met. Deletion always happens from the end of the log.

log.retention.hours:The minimum age of a log file to be eligible for deletion


log.retention.bytes:A size-based retention policy for logs. Segments are pruned from the log as long as the remaining segments don’t drop below log.retention.bytes.


log.segment.bytes:The maximum size of a log segment file. When this size is reached a new log segment will be created.


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



zookeeper.connect: Zookeeper connection string is a comma separated host:port pairs, each corresponding to a zk server. e.g. “,,”. We can also append an optional root string to the urls to specify theroot directory for all kafka znodes.


zookeeper.connection.timeout.ms: Timeout in ms for connecting to zookeeper.


Read More on Kafka


Integrate Filebeat, Kafka, Logstash, Elasticsearch and Kibana