RocketMQ 提供有控制台及一系列控制台命令,用于对主题,集群,broker等信息的管理;
登录控制台:
首先进入RocketMQ 工程,进入/RocketMQ/bin
在该目录下有个mqadmin 脚本
查看帮助:
在mqadmin 下可以查看有哪些命令
sh mqadmin
查看具体命令的使用
sh mqadmin help 命令名称
例如,查看updateTopic 的使用
sh mqadmin help updateTopic
常用命令使用
查看集群信息
sh mqadmin clusterList -n 127.0.0.1:9876
查看Topic 列表信息
sh mqadmin topicList –n 127.0.0.1:9876
查看Topic 路由信息
sh mqadmin topicRoute –n 127.0.0.1:9876 –t topicName
{
"brokerDatas":[
{
"brokerAddrs":{0:"10.1.5.143:10911
},
"brokerName":"RX-WJ46400"
}
],
"filterServerTable":{},
"queueDatas":[
{
"brokerName":"RX-WJ46400",
"perm":6,
"readQueueNums":4,
"topicSynFlag":0,
"writeQueueNums":4
}
]
}
查看Topic 统计信息
sh mqadmin topicStatus –n 10.45.47.168:9876 –t topicName
#Broker Name #QID #Min Offset #Max Offset #Last Updated
RX-WJ46400 0 0 14 2018-05-23 15:07:46,366
RX-WJ46400 1 0 0
RX-WJ46400 2 0 1 2018-05-22 15:56:46,551
RX-WJ46400 3 0 0
查看Broker 统计信息
sh mqadmin brokerStatus -n 127.0.0.1:9876 -b 127.0.0.1:10911
根据消息Key 查询消息
sh mqadmin queryMsgByKey -n 127.0.0.1:9876 -t topicName -k 17dfbd08-4f82-4e1a-8a78-ebdefb0176c4
#Message ID #QID #Offset
0A01058F00002A9F000000000026234D 0 13
根据消息ID 查询消息
sh mqadmin queryMsgById -n 127.0.0.1:9876 -i 0A01058F00002A9F00000000002621CA
Topic: SCHEDULE_TOPIC_XXXX
Tags: [MQ_TAG_PRODUCER_DEMO_1]
Keys: [17dfbd08-4f82-4e1a-8a78-ebdefb0176c4]
Queue ID: 3
Queue Offset: 48
CommitLog Offset: 2499018
Reconsume Times: 0
Born Timestamp: 2018-05-23 15:07:16,360
Store Timestamp: 2018-05-23 15:07:16,366
Born Host: 10.1.5.143:60877
Store Host: 10.1.5.143:10911
System Flag: 0
Properties: {REAL_TOPIC=MQ_TOPIC_PRODUCER_DEMO, KEYS=17dfbd08-4f82-4
-8a78-ebdefb0176c4, WAIT=true, DELAY=4, TAGS=MQ_TAG_PRODUCER_DEMO_1, REAL_QID
Message Body Path: /tmp/rocketmq/msgbodys/0A01058F00002A9F00000000002621CA
查询Producer 的网络连接
sh mqadmin producerConnection -n 127.0.0.1:9876 -g groupName -t topicName
0001 10.1.5.143@1308 10.1.5.143:60877 JAVA V346_SNAPSHOT
查询Consumer 的网络连接
sh mqadmin consumerConnection -n 127.0.0.1:9876 -g consumeGroupName
001 10.1.5.143@9456 10.1.5.143:60855 JAVA V346_SNAPSHOT
Below is subscription:
001 Topic: %RETRY%MQ_CONSUMER_GROUP_DEMO_1 SubExpression: *
002 Topic: MQ_TOPIC_PRODUCER_DEMO SubExpression: MQ_TAG_PRODUCER_DEMO_1
ConsumeType: CONSUME_PASSIVELY
MessageModel: CLUSTERING
ConsumeFromWhere: CONSUME_FROM_FIRST_OFFSET
查看订阅组消费状态
sh mqadmin consumerProgress -n 127.0.0.1:9876 -g consumeGroupName
#Topic #Broker Name #QID #Broker Offset #Consumer Offset #Diff
%RETRY%MQ_CONSUMER_GROUP_DEMO_1 RX-WJ46400 0 47 47 0
MQ_TOPIC_PRODUCER_DEMO RX-WJ46400 0 14 14 0
MQ_TOPIC_PRODUCER_DEMO RX-WJ46400 1 0 0 0
MQ_TOPIC_PRODUCER_DEMO RX-WJ46400 2 1 1 0
MQ_TOPIC_PRODUCER_DEMO RX-WJ46400 3 0 0 0
Consume TPS: 0
Diff Total: 0