MQ命令
常用命令
- 獲取所有可用命令:
mqadmin
- 查看幫助:
mqadmin <command> -h
- 查詢Producer的網絡連接情況:
sh mqadmin producerConnection -n localhost:9876
-g <producer-group> -t <producer-topic>
- 查詢Consumer的網絡連接情況:
sh mqadmin consumerConnection -n localhost:9876
-g <consumer-group>
- 查詢Consumer的消費狀態:
sh mqadmin consumerProgress -n localhost:9876
-g <consumer-group>
查詢消息是否發送成功
- 獲取指定Topic:
mqadmin topicList -n localhost:9876 | grep <topicName>
- 查看Topic狀態:
mqadmin topicStatus -n localhost:9876 -t <topicName>
- 根據offset獲取消息:
sh mqadmin queryMsgByOffset -n localhost:9876
-b <broker-name> -i <queueId> -o <offset> -t <topicName>
- 根據offsetMsgId查詢消息:
sh mqadmin queryMsgById -n localhost:9876
-i <offsetMsgId>
查詢消息是否被消費成功
- 查詢消息詳情:
mqadmin queryMsgById -i {MsgId} -n {NameServerAddr}
查看Consumer
Group訂閱了哪些TOPIC
mqadmin consumerProgress -g <ConsumerGroup> -n <NameServerAddr>
查詢TOPIC被哪些Consumer
Group訂閱了
- 沒有查詢特定TOPIC訂閱情況,只能查詢所有後再過濾:
mqadmin statsAll -n <NameServerAddr>
| grep <TOPIC>
返回結果:#Topic #Consumer Group #InTPS #OutTPS #InMsg24Hour #OutMsg24Hour