搭建kafka消息队列服务

官网:http://kafka.apache.org/

http://kafka.apache.org/quickstart


环境:ubuntu 16.04

1.安装JDK

2.安装zookeeper,并启动

3.下载解压

wget http://mirrors.hust.edu.cn/apache/kafka/1.1.0/kafka_2.12-1.1.0.tgz

tar -zxvf kafka_2.12-1.1.0.tgz

4.运行kafka server

cd kafka_2.12-1.1.0

bin/kafka-server-start.sh config/server.properties


config/server.properties文件中,指定了连接zookeeper服务地址


5.创建生产者Producer

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic monitor

(topic中不能带斜杠/)


6.创建消费者Consumer

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic monitor --from-beginning


猜你喜欢

转载自blog.csdn.net/yhtppp/article/details/80804136