wget https://mirrors.cnnic.cn/apache/kafka/2.0.0/kafka_2.11-2.0.0.tgz
解壓
Tar -xvf kafka_2.11-2.0.0.tgz
進入
cd kafka_2.11-2.0.0/config
vi server.properties
去掉注視
advertised.listeners=PLAINTEXT:你的IP地址
進入bin目錄啟動
./kafka-server-start.sh ../config/server.properties
創建topic
./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test3
查看所有的topic信息
./kafka-topics.sh --list --zookeeper localhost:2181
啟動生產者
./kafka-console-producer.sh --broker-list 47.105.105.2:9092 --topic test
啟動消費者
./kafka-console-consumer.sh --bootstrap-server 47.105.105.2:9092 --topic test3 --from-beginning