Using RocketMQ mqadmin Commands for Monitoring and Managing Topics, Producers, and Consumers
This guide demonstrates how to navigate to the RocketMQ bin directory and use various mqadmin CLI commands to list available commands, check help, monitor producer and consumer connections, query topic status, retrieve messages by offset or ID, and shut down the NameServer and brokers.
Switch to the RocketMQ /usr/local/rocketmq/bin directory:
cd /usr/local/rocketmq/bin
List all available mqadmin commands:
sh mqadmin
Show help for a specific command:
sh mqadmin <command> -h
Monitor producer network connections:
sh mqadmin producerConnection -n localhost:9876 -g <producer-group> -t <producer-topic>
Monitor consumer network connections:
sh mqadmin consumerConnection -n localhost:9876 -g <consumer-group>
Check consumer consumption status:
sh mqadmin consumerProgress -n localhost:9876 -g <consumer-group>
Query whether a message was sent successfully and retrieve specific topics:
sh mqadmin topicList -n localhost:9876 | grep <topicName>
View topic status:
sh mqadmin topicStatus -n localhost:9876 -t <topicName>
Retrieve messages by offset:
sh mqadmin queryMsgByOffset -n localhost:9876 -b <broker-name> -i <queueId> -o <offset> -t <topicName>
Retrieve messages by message ID:
sh mqadmin queryMsgById -n localhost:9876 -i <offsetMsgId>
Check if a message was consumed successfully and view message details:
sh mqadmin queryMsgById -i {MsgId} -n {NameServerAddr}
List consumer groups subscribed to a topic (no direct query, filter after listing all):
sh mqadmin statsAll -n <NameServerAddr> | grep <TOPIC>
Shut down the NameServer and all brokers:
sh mqshutdown namesrv
sh mqshutdown broker
View all consumer groups:
sh mqadmin consumerProgress -n 192.168.20.40:9876
View topic data accumulation for a specific consumer group:
sh mqadmin consumerProgress -n 192.168.20.40:9876 -g GroupConsumer
List all topics and view detailed statistics:
sh mqadmin topicList -n 192.168.20.40:9876
sh mqadmin topicstatus -n 192.168.20.40:9876 -t myTopicTest1
Create a new topic:
sh mqadmin updateTopic –n 192.168.20.43 –c DefaultCluster –t ZTEExample
Delete a topic:
sh mqadmin deleteTopic –n 192.168.20.43:9876 –c DefaultCluster –t ZTEExample
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.