Apache Kafka Commands

‣ Create topic= hello-topic with 4 partitions and replication factor 1
kafka-topics --create --topic hello-topic --partitions 4 --replication-factor 1 --zookeeper localhost:2181
‣ List out the available topics.
kafka-topics --list --zookeeper localhost:2181
‣ Describe the topic, with Leader, replication, ISR and partition
kafka-topics --describe --topic hello-topic --zookeeper localhost:2181
‣ Start Producer
kafka-console-producer --topic hello-topic --bootstrap-server localhost:9092
‣ Start Consumer- from beginning, without beginning.
kafka-console-consumer --topic hello-topic --bootstrap-server localhost:9092

kafka-console-consumer --topic hello-topic --bootstrap-server localhost:9092 --from-beginning

‣ Sharing the information in between group-1
kafka-console-consumer --topic hello-topic --bootstrap-server localhost:9092 --group group-1
kafka-console-consumer --topic hello-topic --bootstrap-server localhost:9092 --group group-1
‣ To see the Describe for group-1
kafka-consumer-groups --describe --bootstrap-server localhost:9092 --group group-1
‣ Same information will be shared group-1 and group-2
kafka-console-consumer --topic hello-topic --bootstrap-server localhost:9092 --group group-1
kafka-console-consumer --topic hello-topic --bootstrap-server localhost:9092 --group group-2
‣ If output is other than string need deserialize to check the output- My out was integer I used IntegerDeserializer to see right output
kafka-console-consumer --topic test-ex-output-topic --value-deserializer org.apache.kafka.common.serialization.IntegerDeserializer --from-beginning --bootstrap-server localhost:9092
‣ To print avro formated data
kafka-avro-console-consumer --topic test-specific-topic --bootstrap-server localhost:9092 --from-beginning