Add one kafka topic with 2 replicas and 4 partitions with the below command

<kafka_installation>/bin/kafka-topics --create --zookeeper <zkhosts> --topic <topicname> --replication-factor 2 --partitions 4

Example : /opt/kafka/bin/kafka-topics --create --zookeeper host1:2181,host2:2181,host3:2181/new --topic testtopic --replication-factor 2 --partitions 4

Add multiple kafka topics with 2 replicas and 4 partitions with the below command

Create new file topics.txt with the below like content(topic names)

testtopic1
testtopic2
testtopic3

Command (on linux)

cat topics.txt | xargs -n1 /opt/kafka/bin/kafka-topics --create --zookeeper host1:2181 --topic testtopic --replication-factor 2 --partitions 4

Related Post

Leave a Comment

Automate processes around your Kafka clusters with workflows, reduced risk full audit, governance.

About Us

Follow Us

Email: info@kafkawize.com

Phone: +31 20 8230443

© 2020 Kafkawize Technology Solutions. All rights reserved. Registered company in The Netherlands.