# zk启动
bin/zookeeper-server-start.sh -daemon config/zookeeper.properties

# kafka启动
bin/kafka-server-start.sh config/server.properties


# 创建topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
# 查看topic
bin/kafka-topics.sh --list --zookeeper localhost:2181

# 生产消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test


# 消费消息
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

# 停止kafka
bin/kafka-server-stop.sh config/server.properties

# 停止zk
bin/zookeeper-server-stop.sh config/zookeeper.properties

  

posted on 2020-03-28 20:50  海豚汪洋  阅读(482)  评论(0编辑  收藏  举报