版本:0.9.x - 0.10.x
1.启动zookeeper
./bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
2.启动kafka
./bin/kafka-server-start.sh config/server.properties &
3.创建topic
./bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic test-002 --partitions 2 --replication-factor 1
3.查看 topic 列表
./bin/kafka-topics.sh --zookeeper localhost:2181 --list
4.查看 指定 topic 信息
./bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic iod-1400-vehicle
5.生产者
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
6.消费者
./bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
7.消费进度
./bin/kafka-consumer-offset-checker.sh --zookeeper localhost:2181 --topic test --group test
8.查看消费组
./bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list --new-consumer
9.查看消费组进度
./bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group test --new-consumer
10.查看topic数据量
./bin/kafka-run-class.sh kafka.tools.GetOffsetShell --time -1 --broker-list p-node-2222:9092 --topic test
11.查看topic具体数据
./bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test