liveBook · Manning

Topic creation

As explained in Apache Kafka in Action

Topic creation is the Kafka operation that creates a named topic with configured partitions and replicas.

Topic creation names a Kafka topic and assigns its partitions and replication factor. These settings balance parallel processing against reliability: more partitions support parallelism, while more replicas improve resilience. section 3.1.2

Create and inspect a changelog topic

Create products.prices.changelog with two partitions and two replicas using kafka-topics.sh. Then inspect it with --describe: Kafka reports each partition's leader, replicas, and in-sync replicas. In the example, broker 3 leads partition 0 and broker 1 leads partition 1. section 3.1.2

$ kafka-topics.sh \
    --create \
    --topic products.prices.changelog \
    --replication-factor 2 \
    --partitions 2 \
    --bootstrap-server localhost:9092
Created topic procuts.prices.changelog.

Run the annotated kafka-topics.sh command to create a topic with an explicit name, replication factor, partition count, and bootstrap server. section 3.1.2

Partitions can be increased later with --alter, but the resulting distribution and leadership should be checked with --describe. section 3.1.2

How Apache Kafka in Action covers it

How deep it goes
Explains creation commands, partition and replica effects, broker leadership, inspection output, and later partition increases.
Examples
Uses products.prices.changelog, two partitions, two replicas, broker assignments, and a third-partition alteration.
What you can do after
Operate Kafka topics with kafka-topics.sh and verify their partition, replica, and leader assignments.
How it connects
Connects topic creation with partitions, replication factor, replicas, brokers, leaders, and in-sync replicas.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Apache Kafka in Action. The section links point to the parts of the book it draws on.