常用命令:
# 1.创建topic
./kafka-topics.sh
--create -- 指定创建topic
--topic test1 -- 指定创建的topic名称
--partitions 1 -- 指定分区数
--replication-factor 1 -- 指定分区的replicas数
--bootstrap-server hadoop0:909 -- 指定kafka服务的地址
# 2.监听topic消息
./kafka-console-consumer.sh
--topic test1 --指定topic
--bootstrap-server hadoop0:9092 --指定kafka服务的地址
--from-beginning --从开始位置读
# 3.推送topic消息
./kafka-console-producer.sh
--bootstrap-server hadoop0:9092 -- 指定kafka服务的地址
--topic test1 -- 指定topic