查看Kafka group中的历史消息
- 进入Kafka容器
1 docker exec -it staging_kafka bash 2 cd opt/kafka/bin
- 查看group情况
1 bash-4.4# ./kafka-consumer-groups.sh --bootstrap-server xxx.xxx.x.xx:xxxxx --list 2 kzy-record-group 3 kzy-rtp-group
- 查看group消费情况
1 bash-4.4# ./kafka-consumer-groups.sh --bootstrap-server xxx.xxx.x.xx:xxxxx --describe --group kzy-record-group 2 3 GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
当前已消费的条数 总条数 未消费的条数 4 kzy-record-group wecom-chat-message-1 1 61 61 0 BATCH_CLIENT_1-82ec8469-0486-4aab-bf26-9c2a7dc10127 /xxx.xxx.xxx.x BATCH_CLIENT_1 5 kzy-record-group wecom-chat-message-1 3 115 115 0 BATCH_CLIENT_3-2952df8e-7dbe-4aa8-9133-d60963cd8707 /xxx.xxx.xxx.x BATCH_CLIENT_3 6 kzy-record-group wecom-chat-message-1 0 123 123 0 BATCH_CLIENT_0-f4f72233-dc0f-4e6c-80db-701fab3254e1 /xxx.xxx.xxx.x BATCH_CLIENT_0 7 kzy-record-group wecom-chat-message-1 2 148 148 0 BATCH_CLIENT_2-cb93e139-c3c3-4727-8156-dff1b95d0f56 /xxx.xxx.xxx.x BATCH_CLIENT_2
- 查看某一个partion的消息
1 bash-4.4# ./kafka-console-consumer.sh --bootstrap-server xxx.xxx.x.xx:xxxxx --topic wecom-chat-message-1 --from-beginning --partition 1 2 {"msgid": ...} 3 bash-4.4# ./kafka-console-consumer.sh --bootstrap-server xxx.xxx.x.xx:xxxxx --topic wecom-chat-message-1 --partition 1 --offset 60(索引为60,至最后。所以只显示一条数据) 4 {"msgid": "898631262130785510_1612683488", "action": "send", "from": "zhida@kezhiyin.com", "tolist": ["SunSiMing", "6Yue", "AnLanLanMiao", "WangFang", "GuoWei", "sunshaofu@kezhiyin.com", "tianyu@kezhiyin.com", "WangYu", "WangXiaoYu", "zhifan@kezhiyin.com"], "roomid": "wrMevnDgAADnHliG445yaJznthUOmQ3Q", "msgtime": 1612683487986, "msgtype": "text", "text": {"content": "\u8f9b\u82e6"}, "seq": 57650}
分享促进成长