Kafka Commands | Kafa Important Commands | Kafka Beginner Commands

 Create topic Command

kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic YourTopicName


Run Producer

kafka-console-producer.bat --broker-list localhost:9092 --topic TopicToSubscribe






Run Consumer

kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic TopicToSubscribe



Create and describe demo user permission

kafka-acls.bat --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:demouser --operation Create --operation Describe  --topic demo-topic

Producer with config

kafka-console-producer.bat --broker-list localhost:9094 --topic demo-topic --producer.config ../../config/ssl-producer.properties


Run consumer with config

kafka-console-consumer.bat --bootstrap-server localhost:9094 --topic demo-topic --from-beginning --consumer.config ../../config/ssl-consumer.properties


kafka-acls.bat --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:demouser --consumer --topic demo-topic --group demo-consumer-group


Serve start with config

set KAFKA_OPTS=-Djava.security.auth.login.config=C:/DefaultKafka2/kafka_2.13-2.4.1/config/kafka_server_jaas.conf


Add user

kafka-configs.bat --zookeeper localhost:2181 --alter --add-config "SCRAM-SHA-512=[password="secret"]" --entity-type users --entity-name demouser


Get all topics

kafka-topics.bat --list --zookeeper localhost:2181


Create topic

bin/windows/kafka-topics.bat --create --bootstrap-server localhost:9094 --command-config ../../config/ssl-user-config.properties --replication-factor 1 --partitions 1 --topic demo-topic






Assign permission

kafka-acls.bat --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:demouser --producer --topic demo-topic

JDK install for keytool

OpenSsl instal


//create user

go to bin/windows folder

kafka-configs.bat --zookeeper localhost:2181 --alter --add-config "SCRAM-SHA-512=[password="admin-secret"]" --entity-type users --entity-name admin

Post a Comment

0 Comments