Topic alteration changes an existing Kafka topic when its original capacity or reliability is no longer sufficient. It avoids deleting and recreating the topic, which would risk losing its data. section 3.1.2
Increase partitions without recreating the topic
For products.prices.changelog, increase the partition count from two to three with kafka-topics.sh --alter --topic products.prices.changelog --partitions 3 --bootstrap-server localhost:9092. The existing partitions retain their leaders and replicas; Kafka adds partition 2 with broker 2 as leader and broker 3 as another replica. section 3.1.2
$ kafka-topics.sh \
--alter \
--topic products.prices.changelog \
--partitions 3 \
--bootstrap-server localhost:9092
Use the alteration command as a starting point, then describe the topic to verify its new partition count and broker assignments. section 3.1.2 section 3.1.2
