1. 启动 zookeeper:
./bin/zookeeper-server-start.sh config/zookeeper.properties
2.启动 kafka
./bin/kafka-server-start.sh config/server.properties
3. 消费端
(base) bogon:kafka_2.12-2.2.0 rand$ bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
zookeeper is not a recognized option
已经过时了。替换为:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
4. 生产端:
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
5. 创建topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic my_favorite_topic
网友评论