RocketMQ Message相关命令【实战笔记】

1.发送测试消息
bin/mqadmin checkMsgSendRT -n 192.168.x.x:9876 -t topic_online_test -s 1024
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0Broker Name                      QID  #Send Result            RTbroker-a                          0     true                    314broker-a                          1     true                    0broker-a                          2     true                    0
broker-a                          3     true                    0
broker-b                          0     true                    2
broker-b                          1     true                    1
broker-b                          2     true                    1
broker-b                          3     true                    0
broker-a                          0     true                    1
broker-a                          1     true                    0
broker-a                          2     true                    0
broker-a                          3     true                    1
broker-b                          0     true                    4
-t topic topic name
-a amount message amout | default 100
-s size message size | default 128 Byte
2.print message by queue
bin/mqadmin printMsgByQueue -n 192.168.1.x:9876 -b 192.168.1.x -i 0
3.打印topic中的信息
bin/mqadmin printMsg -n 192.168.1.x:9876 -t SCANRECORD
"t", "topic", true, "topic name"
"c", "charsetName ", true, "CharsetName(eg: UTF-8,GBK)"
"s", "subExpression ", true, "Subscribe Expression(eg: TagA || TagB)"
"b", "beginTimestamp ", true,  Begin timestamp[currentTimeMillis|yyyy-MM-dd#HH:mm:ss:SSS]
"e", "endTimestamp ", true, End timestamp[currentTimeMillis|yyyy-MM-dd#HH:mm:ss:SSS]
"d", "printBody ", true,"print body"
MSGID: C0A81F8166832F2C9B1953831616FB45 MessageExt [queueId=20, storeSize=686, queueOffset=35052080, sysFlag=0, bornTimestamp=1539724299798, bornHost=/192.168.x.x:29781, storeTimestamp=1539724299179, storeHost=/192.168.x.x:10911, msgId=C0A801B400002A9F000005F308F9B3A5, commitLogOffset=6541385773989, bodyCRC=1167936923, reconsumeTimes=0, preparedTransactionOffset=0, toString()=Message [topic=SCANRECORD, flag=0, properties={MIN_OFFSET=35046369, MAX_OFFSET=40298522, KEYS=1dd04932-b7d9-43ee-8b31-39d16dd043d4, UNIQ_KEY=C0A81F8166832F2C9B1953831616FB45, WAIT=true, TAGS=2}, body=484]] BODY: {"billCode":"640010206680","blReturnBillId":0,"blUntreadPieceId":0,"clazz":"2","dataFrom":"2","dispatchId":0,"ownerBagNo":"3783585805","pdaCode":"S50117101164","piece":1,"preOrNexStaId":14761,"preOrNextStation":"\u6F6E\u6C55\u4E2D\u5FC3","prepProvinceId":440000,"registerDate":1539724298000,"scanDate":1539724241000,"scanMan":"\u9648\u4E9A\u5973","scanManCode":"020019.0865","scanProvinceId":440000,"scanSite":"\u5E7F\u5DDE\u5E7F\u56ED","scanSiteId":1051037,"scanType":"\u53D1\u4EF6"}
4.通过messageId查询消息
bin/mqadmin queryMsgById -n 192.168.x.x:9876  -i C0A801B400002A9F000005F308F9B3A5
"i", "msgId", true, "Message Id"
"consumerGroup", true, "consumer group name"
"clientId", true, "The consumer's client id"
"sendMessage", true, "resend message"
"unitName", true, "unit name"
bin/mqadmin queryMsgById -n 192.168.x.x:9876  -i C0A801B400002A9F000005F308F9B3A5
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
OffsetID:            C0A801B400002A9F000005F308F9B3A5
OffsetID:            C0A801B400002A9F000005F308F9B3A5
Topic:               SCANRECORD
Tags:                [2]
Keys:                [1dd04932-b7d9-43ee-8b31-39d16dd043d4]
Queue ID:            20
Queue Offset:        35052080
CommitLog Offset:    6541385773989
Reconsume Times:     0
Born Timestamp:      2018-10-17 05:11:39,798
Store Timestamp:     2018-10-17 05:11:39,179
Born Host:           192.168.31.129:29781
Store Host:          192.168.1.180:10911
System Flag:         0
Properties:          {KEYS=1dd04932-b7d9-43ee-8b31-39d16dd043d4, UNIQ_KEY=C0A81F8166832F2C9B1953831616FB45, WAIT=true, TAGS=2}
Message Body Path:   /tmp/rocketmq/msgbodys/C0A81F8166832F2C9B1953831616FB45
MessageTrack [consumerGroup=ZtoSignGroup, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=newOpenPartnerDeadlineJob, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=smartidivision-scanrecord-dis, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=PanguRecordGroup, trackType=CONSUMED, exceptionDesc=null]MessageTrack [consumerGroup=code-send-consumer, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=shenZhouOneSiteKpiConsumer, trackType=CONSUMED, exceptionDesc=null]MessageTrack [consumerGroup=SortComplementConsumer, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=tf_wonder_waybill_center_scanrecord, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=dpmComScanRecordConsumer, trackType=UNKNOWN, exceptionDesc=org.apache.rocketmq.client.exception.MQClientException: CODE: 17  DESC: No topic route info in name server for the topic: %RETRY%dpmComScanRecordConsumer
See [http://rocketmq.apache.org/docs/faq/](http://rocketmq.apache.org/docs/faq/) for further details., org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1212)]MessageTrack
5.根据key查询存储消息
bin/mqadmin queryMsgByKey -n 192.168.x.x:9876 -t SCANRECORD -k 1dd04932-b7d9-43ee-8b31-39d16dd043d4
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
Message ID                                        QID                                  Offset
C0A81F8166832F2C9B1953831616FB45                     20                                 35052080
6.根据offset查询储存消息
bin/mqadmin  queryMsgByOffset -n 192.168.x.x:9876 -t SCANRECORD -b broker-a -i 20 -o 35052080
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
OffsetID:            C0A801B400002A9F000005F308F9B3A5
OffsetID:            C0A801B400002A9F000005F308F9B3A5
Topic:               SCANRECORD
Tags:                [2]
Keys:                [1dd04932-b7d9-43ee-8b31-39d16dd043d4]
Queue ID:            20
Queue Offset:        35052080
CommitLog Offset:    6541385773989
Reconsume Times:     0
Born Timestamp:      2018-10-17 05:11:39,798
Store Timestamp:     2018-10-17 05:11:39,179
Born Host:           192.168.31.129:29781
Store Host:          192.168.1.180:10911
System Flag:         0
Properties:          {MIN_OFFSET=35046369, MAX_OFFSET=40342481, KEYS=1dd04932-b7d9-43ee-8b31-39d16dd043d4, UNIQ_KEY=C0A81F8166832F2C9B1953831616FB45, WAIT=true, TAGS=2}
Message Body Path:   /tmp/rocketmq/msgbodys/C0A81F8166832F2C9B1953831616FB45
MessageTrack [consumerGroup=ZtoSignGroup, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=newOpenPartnerDeadlineJob, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=smartidivision-scanrecord-dis, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=PanguRecordGroup, trackType=CONSUMED, exceptionDesc=null]MessageTrack [consumerGroup=code-send-consumer, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=shenZhouOneSiteKpiConsumer, trackType=CONSUMED, exceptionDesc=null]MessageTrack [consumerGroup=SortComplementConsumer, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=tf_wonder_waybill_center_scanrecord, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=dpmComScanRecordConsumer, trackType=UNKNOWN, exceptionDesc=org.apache.rocketmq.client.exception.MQClientException: CODE: 17  DESC: No topic route info in name server for the topic: %RETRY%dpmComScanRecordConsumer
See [http://rocketmq.apache.org/docs/faq/](http://rocketmq.apache.org/docs/faq/) for further details., org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1212)]MessageTrack [
"t", "topic", true, "topic name"
"b", "brokerName", true, "Broker Name"
"i", "queueId", true, "Queue Id"
"o", "offset", true, "Queue Offset"
7.通过UniqueKey查询消息内容
bin/mqadmin queryMsgByUniqueKey -n 192.168.x.x:9876  -t SCANRECORD -i C0A801B400002A9F000005F308F9B3A5
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
Topic:               SCANRECORD
Tags:                [2]
Keys:                [1dd04932-b7d9-43ee-8b31-39d16dd043d4]
Queue ID:            20
Queue Offset:        35052080
CommitLog Offset:    6541385773989
Reconsume Times:     0
Born Timestamp:      2018-10-17 05:11:39,798
Store Timestamp:     2018-10-17 05:11:39,179
Born Host:           192.168.31.129:29781
Store Host:          192.168.1.180:10911
System Flag:         0
Properties:          {KEYS=1dd04932-b7d9-43ee-8b31-39d16dd043d4, UNIQ_KEY=C0A81F8166832F2C9B1953831616FB45, WAIT=true, TAGS=2}
Message Body Path:   /tmp/rocketmq/msgbodys/C0A81F8166832F2C9B1953831616FB45
MessageTrack [consumerGroup=ZtoSignGroup, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=newOpenPartnerDeadlineJob, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=smartidivision-scanrecord-dis, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=PanguRecordGroup, trackType=CONSUMED, exceptionDesc=null]MessageTrack [consumerGroup=code-send-consumer, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=shenZhouOneSiteKpiConsumer, trackType=CONSUMED, exceptionDesc=null]MessageTrack [consumerGroup=SortComplementConsumer, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=tf_wonder_waybill_center_scanrecord, trackType=CONSUMED_BUT_FILTERED, exceptionDesc=null]MessageTrack [consumerGroup=dpmComScanRecordConsumer, trackType=UNKNOWN, exceptionDesc=org.apache.rocketmq.client.exception.MQClientException: CODE: 17  DESC: No topic route info in name server for the topic: %RETRY%dpmComScanRecordConsumer
See [http://rocketmq.apache.org/docs/faq/](http://rocketmq.apache.org/docs/faq/) for further details., org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1212)]MessageTrack 
"i", "msgId", true, "Message Id"
"g", "consumerGroup", true, "consumer group name"
"d", "clientId", true, "The consumer's client id"
"t", "topic", true, "The topic of msg"
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值