一、安装zookeeper
1.下载zookeeper:https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
2.解压后重命名conf中的zoo_sample.cfg为zoo.cfg
3.打开终端进入bin目录执行:./zkServer.sh start &
二、安装kafka
1.下载kafka:http://mirrors.hust.edu.cn/apache/kafka/0.10.2.0/kafka_2.12-0.10.2.0.tgz
2.解压后打开终端进入bin目录执行:./kafka-server-start.sh ../config/server.properties
3.打开另一个终端执行:./kafka-topics.sh –create –topic kafkatopic –replication-factor 1 –partitions 1 –zookeeper localhost:2181
4.测试生产消息:./kafka-console-producer.sh –broker-list localhost:9092 –sync –topic kafkatopic
5.测试消费消息:./kafka-console-consumer.sh –bootstrap-server localhost:9092 –topic kafkatopic –from-beginning