创建topic
命令:kafka-topics.sh --create --zookeeper hcmaster:2181 --partitions 2 --replication-factor 2 --topic first
命令:kafka-topics.sh --list --zookeeper hcmaster:2181
命令:kafka-topics.sh --zookeeper hcmaster:2181 --describe --topic first
命令:kafka-console-producer.sh --broker-list hcmaster:9092 --topic first
命令:kafka-console-consumer.sh --bootstrap-server hcmaster:9092 --from-beginning --topic first
–from-beginning:会把first主题中之前所有的数据都读取出来。可根据业务场景选择是否增加该配置。