RocketMq 查询


  1. 登陆一台有mq查询命令的服务器

    cd /usr/local/alibaba-rocketmq-3.5.8/bin/
    
  2. 通过topic和key值确定需要查询的消息ID范围

    sh mqadmin queryMsgByKey -n ip:port -k msgKey -t topic_name
    
  3. 通过消息ID查询具体的消息信息

    sh mqadmin queryMsgById -n ip:port -i msgId
    
  4. 显示详细的消息

    sh mqadmin printMsg -c UTF-8 -n ip:9876 -t topic_ems_dist_prop -s direct -b 2018-11-27#12:41:40:123
    
    # 查询具体时间段的消息
    sh mqadmin printMsg -t topic_dsdzCTbox -n ip:9876 -b 2019-05-05#09:16:30:000 -e 2019-05-05#09:17:30:000
    
  5. 实例

    $ sh /usr/local/alibaba-rocketmq-3.5.8/bin/mqadmin queryMsgByKey -n ip:9876 -t topic_truck_load  -k msgKey
    
    $ sh /usr/local/alibaba-rocketmq-3.5.8/bin/mqadmin queryMsgById -n ip:9876 -i msgId >/dev/null && less /tmp/rocketmq/msgbodys/msgId
    
    sh mqadmin queryMsgByKey -n ip:9876 -t topic_gps_trace -k 700007ca4BJD372