Introduction to Apache Kafka
Mike Metzger
Data Engineering Consultant
bin/kafka-topics.sh
scriptbin/kafka-topics.sh
--bootstrap-server <server>
--topic <topicname>
--create
$ bin/kafka-topics.sh --bootstrap-server localhost:9092 \
--topic orders --create
Created topic orders
Optional arguments for bin/kafka-topics.sh --create
--replication-factor <x>
--partitions <x>
Example
$ bin\kafka-topics.sh --bootstrap-server localhost:9092 \
--topic orders --create --replication-factor 3 \
--partitions 3
Created topic orders
bin/kafka-topics.sh
--bootstrap-server <server>
--topic <topicname>
--describe
Example
$ bin/kafka-topics.sh --bootstrap-server localhost:9092 \
--topic orders --describe
Topic: orders-new TopicId: <topicid> PartitionCount: 3 ReplicationFactor: 1
Configs:
Topic: orders-new Partition: 0 Leader: 0 Replicas: 0 Isr: 0
Topic: orders-new Partition: 1 Leader: 0 Replicas: 0 Isr: 0
Topic: orders-new Partition: 2 Leader: 0 Replicas: 0 Isr: 0
bin/kafka-topics.sh --bootstrap-server <server> --topic <topicname> --delete
$ bin/kafka-topics.sh --bootstrap-server localhost:9092
--topic orders --delete
$
Introduction to Apache Kafka