Kafka Getting Started 1

About Kafka

As a messaging middleware, Kafka high scalability, high throughput, etc., are widely used in the Internet project.

Unclear Kafka students can take a look at this article:

http://blog.csdn.net/suifeng3051/article/details/48053965

Deployment Kafka

In order to facilitate beginners can quickly try Kafka, article demonstrates how to quickly deploy a simple service with Kafka Docker.

  1. Download kafka mirror of docker:
    docker pull spotify / kafka
    Note: kafka rely zookeeper services, spotify / kafka which integrates well with the zookeeper kafka, achieved a key to start.
  2. In the start kafka in service docker:
    docker RUN -p 2181: 2181 -p 9092: 9092 --env ADVERTISED_HOST = 9092 = 127.0.0.1 --env ADVERTISED_PORT Spotify / kafka

 

 

 

  1. Execution kafka end of production, consumption-side program, view operating results:
    download kafka installation package:
    http://kafka.apache.org/downloads
    Once downloaded decompress into the directory.
    Production end message, the following command line Demo:
    bin / kafka-console-producer.sh --broker-List 127.0.0.1:9092 --topic Test
    message terminal receiving the message, the following command line Demo:
    bin / Console-Consumer-Kafka .sh --zookeeper 127.0.0.1:2181 --topic test --from-beginning

 

 

 

 

 

 

kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic topicName --from-beginning

 

 

 

 

 

 

E:\software\kafka_2.11-2.2.1\kafka_2.11-2.2.1\bin\windows>kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test-topic --from-beginning

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/hbb0b0/p/11427276.html