1.上传
2.解压缩
3.启动zookeeper(kafka自带)
nohup ./bin/zookeeper-server-start.sh config/zookeeper.properties &
3.1验证
4.启动broker
nohup ./bin/kafka-server-start.sh config/server.properties &
4.1验证
5.创建topic
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic demo
5.1查看
./bin/kafka-topics.sh --list --zookeeper localhost:2181
6.启动producer
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic demo
7.启动consumer
新打开一个窗口
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic demo --from-beginning