生产者:
./bin/kafka-console-producer.sh --broker-list 192.168.7.130:9092 --topic test
消费者:
./bin/kafka-console-consumer.sh --bootstrap-server 192.168.7.130:9092 --topic test_topic --property print.timestamp=true
消费组积压查看:
./bin/kafka-consumer-groups.sh --bootstrap-server 192.168.7.130:9092 --describe --group test_group
topic列表查看:
./bin/kafka-topics.sh --zookeeper 192.168.7.130:2181 -list | grep test_topic
topic详情查看:
./bin/kafka-topics.sh --zookeeper 192.168.7.130:2181 --topic test_topic --describe
重置offset:
./bin/kafka-consumer-groups.sh --bootstrap-server 192.168.7.130:9092 --group test_group --reset-offsets --to-offset 1000 --topic test_out --execute
根据时间戳获取offset:
./bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 192.168.5.16:9092 --topic test_topic --time 1651212840000
图形化工具推荐: Kafka tool (新版名字:Offset Explorer)