首先下载kafka安装包
tar -zxvf kafka安装包
cd config
vim server.properties
A.将zookeeper.connect=zookeeper的ip:2181 这一步也可以不做
启动kafka
如果A做了就不做这个B
B. bin/zookeeper-server-start.sh config/zookeepe!
bin/kafka-server-start.sh config/server.properties

创建topic
bin/kafka-topics.sh --create --zookeeper zookeeper所在的ip:2181 --replication-factor 1 --partitions 1 --topic test
查看主题
bin/kafak-topics.sh --list --zookeeper zookeeper所在的ip:2181

启动producer
bin/kafka-console-producer.sh --broker-list localhost:2181 --topic test

启动consumer
bin/kafka-console-consumer.sh --zookeeper zookeeper所在的ip:2181 --topic test
