创建topic
kafka-topic.sh --zookeeper localhost:2181/kafka --create --topic topic_name --partitions num --replication -factor num
实际
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic demoA
修改分区数量
kafka-topic.sh --alter --zookeeper localhost:2181/kafka --partitions num --topic top_name
./bin/kafka-topics.sh --alter --zookeeper localhost:2181/kafka --partitions 7 --topic demoA
查看topic 信息
kafka-top.sh --zookeeper localhost:2181/kafka --top topic_name --describe
./bin/kafka-topics.sh --zookeeper localhost:2181 --describe
生产信息
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic Demo1
监听消费读取数据
kafka-console-consumer.sh --bootstrap-server ip:port --topic topic_name
./bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic DemoA--from-beginning