有時(shí)需要簡單的用shell去檢查一個(gè)topic下邊某一個(gè)partition的某個(gè)offset的消息。
之前一直用 kafka.tools.ConsoleConsumer, 用的心酸。
后來發(fā)現(xiàn)一個(gè)稍強(qiáng)大的工具。
https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example
sample usage:
kafka-run-class.sh kafka.tools.SimpleConsumerShell
--broker-list 'xxxx:9092'
--topic 'xxx.xxx.xx.xx'
--max-messages 1
--offset 12345
--partition 1
其他命令:
kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 'xxxx:9092' --topic 'xxxx' --time -1