# 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