kafka-topics.sh
or kafka-topics.bat command is used to create, delete, describe, or change a
topic.
Execute
below command to create a kafka topic.
Syntax
kafka-topics.sh --bootstrap-server {bootStratServerDetails} --topic {topicName} --create --partitions {numberOfPartitions} --replication-factor {replicationFactor}
kafka-topics.sh --bootstrap-server {bootStratServerDetails} --topic {topicName} --create --partitions {numberOfPartitions} --replication-factor {replicationFactor}
Example
kafka-topics.sh
--bootstrap-server localhost:9092 --topic myFirstTopic --create --partitions 3
--replication-factor 1
Execute
below command to list all the available topics.
kafka-topics.sh
--bootstrap-server localhost:9092 --list
$kafka-topics.sh --bootstrap-server localhost:9092 --list
myFirstTopic
No comments:
Post a Comment