1、如果 -b为空,则必填cluster名称,表示topic建在该集群(集群可通过clusterList查询)-h否打印帮助-n是nameserve服务地址列表,格式ip:port;ip:.-p指定新topic的权限限制( W|R|WR )-r可读队列数(默认为8)-w可写队列数(默认为8)-ttopic名称(名称只能使用字符 a-zA-Z0-9_-+$ )举例在集群DefaultCluster上创建主题ZTEExample,nameserve地址为10.45.47.168:9876sh mqadmin updateTopic n 10.45.47.168 c DefaultCluster t Z
2、TEExample1.2.2.删除TopicdeleteTopicmand.topic.DeleteTopicSubCommandcluster名称,表示删除某集群下的某个topic (集群可通过clusterList查询)在集群DefaultCluster上删除主题ZTEExample,nameserve地址为10.45.47.168:sh mqadmin deleteTopic n 10.45.47.168:9876 c DefaultCluster t ZTEExample1.2.3.创建(修订)订阅组updateSubGroupmand.consumer.UpdateSubGroupS
3、ubCommand如果 c为空,则必填broker地址,表示订阅组建在该broker如果 b为空,则必填-d是否容许广播方式消费-g订阅组名-i从哪个broker开始消费-m是否容许从队列的最小位置开始消费,默认会设置为false-q消费失败的消息放到一个重试队列,每个订阅组配置几个重试队列重试消费最大次数,超过则投递到死信队列,不再投递,并报警-s消费功能是否开启发现消息堆积后,将Consumer的消费请求重定向到另外一台Slave机器1.2.4.删除订阅组配置deleteSubGroupmand.consumer.DeleteSubscriptionGroupCommand1.2.5.更新
4、Broker配置文件updateBrokerConfigmand.broker.UpdateBrokerConfigSubCommand-kkey值-vvalue值1.2.6.查看Topic列表信息topicListnameserve地址为10.45.47.168:sh mqadmin topicList n 10.45.47.168:打印内容:BenchmarkTest%RETRY%simple-consumer-testSELF_TEST_TOPICZTEExample注释:上述头三个主题是RocketMQ默认预先创建1.2.7.查看Topic路由信息topicRoutemand.topi
5、c.TopicRouteSubCommandtopic名称查看主题ZTEExample的路由,nameserve地址为10.45.47.168:sh mqadmin topicRoute n 10.45.47.168:9876 t ZTEExample_Crm brokerDatas:brokerAddrs0:10.45.47.168:10911 ,brokerNamecrmdb ,queueDatas,perm6,readQueueNums8,writeQueueNums8 1.2.8.查看Topic统计信息topicStatsmand.topic.TopicStatsSubCommand查
6、看主题ZTEExample的统计信息,nameserve地址为10.45.47.168:sh mqadmin topicStats n 10.45.47.168:9876 t ZTEExample(统计信息里包括有offset、最后更新时间)#Broker Name #QID #Min Offset #Max Offset #Last Updatedcrmdb 0 1 2014-02-10 11:37:44,977 2 3 4 5 6 71.2.9.查看Broker统计信息brokerStatsmand.broker.BrokerStatsSubCommandbroker地址查看broker(
7、crmdb)的统计信息,broker地址为10.45.47.168:10911,nameserve地址为10.45.47.168:sh mqadmin brokerStats n 10.45.47.168:9876 b 10.45.47.168:10911bootTimestamp : 139*70brokerVersion 29brokerVersionDesc V3_0_7commitLogDiskRatio 0.32690830974763857commitLogMaxOffset 217commitLogMinOffset 0consumeQueueDiskRatiodispatchM
8、axBuffer 1getFoundTps 0.0 0.0 0.0getMessageEntireTimeMax 4getMissTpsgetTotalTpsgetTransferedTpsmsgGetTotalTodayMorningmsgGetTotalTodayNowmsgGetTotalYesterdayMorningmsgPutTotalTodayMorningmsgPutTotalTodayNowmsgPutTotalYesterdayMorningputMessageAverageSize 217.0putMessageDistributeTime 0(0.0%) 1(100.0
9、%)putMessageEntireTimeMax 6putMessageSizeTotalputMessageTimesTotalputTpsruntime 0 days, 3 hours, 21 minutes, 1 seconds sendThreadPoolQueueCapacity 100000sendThreadPoolQueueSize1.2.10.根据消息ID查询消息queryMsgByIdmand.message.QueryMsgByIdSubCommandmsgId查询msgId= 0A2D2FA800002A9F0000000000000000的消息,nameserve地
10、址为10.45.47.168:sh mqadmin queryMsgById n 10.45.47.168:9876 i 0A2D2FA800002A9F0000000000000000打印内容:Topic: ZTEExampleTags: SimpleTestKeys: SimpleTest-1Queue ID:Queue Offset:CommitLog Offset:Born Timestamp: 2014-02-26 14:49:10,875Store Timestamp:48:44,840Born Host: 10.45.46.229:4231Store Host: 10.45.47
11、.168:System Flag:Properties: TAGS=SimpleTest, KEYS=SimpleTest-1, WAIT=trueMessage Body Path: /tmp/rocketmq/msgbodys/0A2D2FA800002A9F00000000000000001.2.11.根据消息Key查询消息queryMsgByKeymand.message.QueryMsgByKeySubCommand-f被查询消息的截止时间msgKeyTopic名称查询Topic= ZTEExample下key= SimpleTest-1的消息,nameserve地址为10.45.4
12、7.168:sh mqadmin queryMsgByKey -n 10.45.47.168:9876 -t ZTEExample -k SimpleTest-1#Message ID #Offset0A2D2FA800002A9F00000000000000001.2.12.根据Offset查询消息queryMsgByOffsetmand.message.QueryMsgByOffsetSubCommandBroker名称,表示订阅组建在该broker(这里需要注意填写的是broker的名称,不是broker的地址,broker名称可以在clusterList查到)query队列id-oof
13、fset值查询brokerName=crm-168,Topic= ZTEExample的第1个队列下offset=0的消息,nameserve地址为10.45.47.168:sh mqadmin queryMsgByOffset -n 10.45.47.168:9876 -b crm-168 -i 0 -t ZTEExample -o 02014-02-26 14:1.2.13.查询Producer的网络连接 该命令只打印当前与cluster连接的producer网络连接信息producerConnectionmand.connection.ProducerConnectionSubComma
14、nd生产者所属组名查询当前属于group(生产者组)=simple-producer-test的生产者到topic=ZTEExample的网络连接,nameserve地址为10.45.47.168:sh mqadmin producerConnection -n 10.45.47.168:9876 -g simple-producer-test -t ZTEExample0001 10.45.46.229simple-producer-test-99f09de2a20a4b6284bb949b452bee0c 10.45.46.229:4332Java1.2.14.查询Consumer的网络连
15、接 该命令只打印当前与cluster连接的consumer网络连接信息consumerConnectionmand.connection.ConsumerConnectionSubCommand消费者所属组名查询当前属于group(消费者组)=simple-consumer-test的消费者的网络连接,nameserve地址为10.45.47.168:sh mqadmin consumerConnection -n 10.45.47.168:9876 -g simple-consumer-test001 10.45.46.229simple-consumer-test-7babbb6021b040d29978494b16d559ae 10.45.46.229:4355 JAVABelow is subscription: Topic: ZTEExample SubExpression: *ConsumeType: CONSUME_ACTIVELYMessageModel: CLUSTERINGConsumeFromWhere: CONSUME_FROM_LAST_OFFSET1.2.15.查看订阅组消费状态
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1