Kafka producer and consumer order testing

     Continue to the last article. After the Kafka environment is built, enter the test phase, first try the most basic production and consumers.

     1. Create a topic, use kafka-topics.sh to create a topic test

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

     2. Create a message producer

      

     Take a look at the zookeeper configuration information: bin / zookeeper-shell.sh localhost: 2181 <<< "get / brokers / ids / 0"

       

     When creating the producer we used ** localhost, ** here we changed to: bin / kafka-console-producer.sh --broker-list PLAINTEXT: // above ip: 9092 --topic test

     3.Create a message consumer; bin / kafka-console-consumer.sh --bootstrap-server PLAINTEXT: // above ip: 9092 --topic test --from-beginning

     Enter the content in the window of the production message, and the consumption window can be printed out: 

      

 

Guess you like

Origin www.cnblogs.com/bigmengzilogs/p/12699663.html