1.

Can the number of partitions for a topic be changed in Kafka?

Answer»

CURRENTLY, Kafka does not allow you to reduce the NUMBER of partitions for a TOPIC. The partitions can be expanded but not SHRUNK. The alter command in Apache Kafka allows you to change the behavior of a topic and its associated configurations. To add EXTRA partitions, use the alter command.

To increase the number of partitions to five, use the following command:

./bin/kafka-topics.sh --alter --zookeeper localhost:2181 --topic sample-topic --partitions 5


Discussion

No Comment Found