Kafka Command

  1. Start the server

     bin/zookeeper-server-start.sh config/zookeeper.properties
     bin/kafka-server-start.sh config/server.properties
    
  2. Create a topic

     bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
    
  3. Query topics

     bin/kafka-topics.sh --list --zookeeper localhost:2181
    
  4. delete topic

     bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic test
    
  5. Send messages

     bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test 
     This is a message
     This is another message
    
  6. Start a consumer

     bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
    
     or
    
     bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
    

results matching ""

    No results matching ""