{"rsdb":{"rid":"397614","subhead":"","postdate":"0","aid":"273657","fid":"76","uid":"1","topic":"1","content":"
\n

\u672c\u6587\u4e3b\u8981\u4ecb\u7ecd RocketMQ \u7ba1\u7406\u5de5\u5177(mqadmin)\u7684\u4f7f\u7528\uff0c\u6587\u4e2d\u6240\u4f7f\u7528\u5230\u7684\u8f6f\u4ef6\u7248\u672c\uff1aRocketMQ 5.1.3\u3001CentOS 7.9.2009\u3002<\/p> \n

1\u3001mqadmin \u8bf4\u660e<\/h2> \n

A\u3001\u6267\u884c\u547d\u4ee4\u65b9\u6cd5\uff1a.\/mqadmin {command} {args}
B\u3001\u51e0\u4e4e\u6240\u6709\u547d\u4ee4\u90fd\u9700\u8981\u914d\u7f6e -n \u8868\u793a NameServer \u5730\u5740\uff0c\u683c\u5f0f\u4e3a ip:port
C\u3001\u51e0\u4e4e\u6240\u6709\u547d\u4ee4\u90fd\u53ef\u4ee5\u901a\u8fc7 -h \u83b7\u53d6\u5e2e\u52a9
D\u3001\u5982\u679c\u65e2\u6709 Broker \u5730\u5740(-b)\u914d\u7f6e\u9879\u53c8\u6709 clusterName(-c)\u914d\u7f6e\u9879\uff0c\u5219\u4f18\u5148\u4ee5 Broker \u5730\u5740\u6267\u884c\u547d\u4ee4\uff0c\u5982\u679c\u4e0d\u914d\u7f6e Broker \u5730\u5740\uff0c\u5219\u5bf9\u96c6\u7fa4\u4e2d\u6240\u6709\u4e3b\u673a\u6267\u884c\u547d\u4ee4\uff0c\u53ea\u652f\u6301\u4e00\u4e2a Broker \u5730\u5740\u3002-b \u683c\u5f0f\u4e3a ip:port\uff0cport \u9ed8\u8ba4\u662f 10911<\/p> \n

2\u3001mqadmin \u4f7f\u7528<\/h2> \n

2.1\u3001Topic \u76f8\u5173<\/h3> \n

2.1.1\u3001\u521b\u5efa\u6216\u66f4\u65b0 Topic \u914d\u7f6e<\/h4> \n
\n
bin\/mqadmin updateTopic -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC -c DefaultCluster -a +message.type=NORMAL<\/pre> \n <\/div> \n 

2.1.2\u3001\u5220\u9664 Topic<\/h4> \n
\n
bin\/mqadmin deleteTopic -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC -c DefaultCluster<\/pre> \n <\/div> \n 

2.1.3\u3001\u67e5\u770b Topic \u5217\u8868\u4fe1\u606f<\/h4> \n
\n
bin\/mqadmin topicList -n 10.49<\/span>.196.33<\/span>:9876<\/span> -c DefaultCluster<\/pre> \n <\/div> \n 

2.1.4\u3001\u67e5\u770b Topic \u8def\u7531\u4fe1\u606f<\/h4> \n
\n
bin\/mqadmin topicRoute -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC<\/pre> \n <\/div> \n 

2.1.5\u3001\u67e5\u770b Topic \u6d88\u606f\u961f\u5217 offset<\/h4> \n
\n
bin\/mqadmin topicStatus -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC<\/pre> \n <\/div> \n 

2.1.6\u3001\u67e5\u770b Topic \u6240\u5728\u96c6\u7fa4\u5217\u8868<\/h4> \n
\n
bin\/mqadmin topicClusterList -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC<\/pre> \n <\/div> \n 

2.1.7\u3001\u6253\u5370 Topic \u8ba2\u9605\u5173\u7cfb\u3001TPS\u3001\u79ef\u7d2f\u91cf\u300124h \u8bfb\u5199\u603b\u91cf\u7b49\u4fe1\u606f<\/h4> \n
\n
bin\/mqadmin statsAll -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC<\/pre> \n <\/div> \n 

2.2\u3001\u96c6\u7fa4\u76f8\u5173<\/h3> \n

2.2.1\u3001\u67e5\u770b\u96c6\u7fa4\u4fe1\u606f\uff0c\u96c6\u7fa4\u3001BrokerName\u3001BrokerId\u3001TPS \u7b49\u4fe1\u606f<\/h4> \n
\n
bin\/mqadmin clusterList -n 10.49<\/span>.196.33<\/span>:9876<\/span><\/pre> \n <\/div> \n 

2.2.2\u3001\u53d1\u9001\u6d88\u606f\u68c0\u6d4b\u96c6\u7fa4\u5404 Broker RT(\u54cd\u5e94\u8017\u65f6)\uff0c\u6d88\u606f\u53d1\u5f80${BrokerName} Topic\u3002<\/h4> \n
\n
bin\/mqadmin clusterRT -n 10.49<\/span>.196.33<\/span>:9876<\/span> -c DefaultCluster<\/pre> \n <\/div> \n 

2.3\u3001Broker \u76f8\u5173<\/h3> \n

2.3.1\u3001\u6839\u636e offsetMsgId \u67e5\u8be2\u6d88\u606f<\/h4> \n
\n
bin\/mqadmin queryMsgById -n 10.49<\/span>.196.33<\/span>:9876<\/span> -i 0A31C42100002A9F000000000012B6D0<\/pre> \n <\/div> \n 

2.3.2\u3001\u6839\u636e\u6d88\u606f Key \u67e5\u8be2\u6d88\u606f<\/h4> \n
\n
bin\/mqadmin queryMsgByKey -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC -k myKey<\/pre> \n <\/div> \n 

2.3.3\u3001\u6839\u636e Offset \u67e5\u8be2\u6d88\u606f<\/h4> \n
\n
bin\/mqadmin queryMsgByOffset -n 10.49<\/span>.196.33<\/span>:9876<\/span> -b broker-a -t TEST_TOPIC -i 6<\/span> -o 1<\/span><\/pre> \n <\/div> \n 

-i\uff1a\u961f\u5217 id\uff0c-o\uff1a\u961f\u5217 offset<\/p> \n

2.3.4\u3001\u6839\u636e messageId \u67e5\u8be2\u6d88\u606f<\/h4> \n
\n
bin\/mqadmin queryMsgByUniqueKey -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC -i 01005056C000014C8C04E5EEEB00000001<\/pre> \n <\/div> \n 

2.3.5\u3001\u68c0\u6d4b\u5411 topic \u53d1\u6d88\u606f\u7684 RT\uff0c\u529f\u80fd\u7c7b\u4f3c clusterRT<\/h4> \n
\n
bin\/mqadmin checkMsgSendRT -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC<\/pre> \n <\/div> \n 

2.3.6\u3001\u53d1\u9001\u6d88\u606f<\/h4> \n
\n
bin\/mqadmin sendMessage -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC -k myKey -c myTag -p messageContent<\/pre> \n <\/div> \n 

-k\uff1a\u6d88\u606f key\uff0c-c\uff1a\u6d88\u606f tag\uff0c-p\uff1a\u6d88\u606f\u5185\u5bb9<\/p> \n

2.3.7\u3001\u6d88\u8d39\u6d88\u606f<\/h4> \n
\n
bin\/mqadmin consumeMessage -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC -g myGroup<\/pre> \n <\/div> \n 

2.3.8\u3001\u4ece Broker \u6d88\u8d39\u6d88\u606f\u5e76\u6253\u5370<\/h4> \n
\n
bin\/mqadmin printMsg -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC<\/pre> \n <\/div> \n 

2.3.9\u3001\u4ece Broker \u6d88\u8d39\u6d88\u606f\u5e76\u6253\u5370(\u6307\u5b9a Message Queue)<\/h4> \n
\n
bin\/mqadmin printMsgByQueue -n 10.49<\/span>.196.33<\/span>:9876<\/span> -a broker-a -t TEST_TOPIC -i 6<\/span> -p true<\/span><\/pre> \n <\/div> \n 

-a\uff1abroker \u540d\u79f0\uff0c-i\uff1a\u961f\u5217 id\uff0c-p\uff1a\u662f\u5426\u6253\u5370\u6d88\u606f<\/p> \n

2.3.10\u3001\u6309\u65f6\u95f4\u6233\u91cd\u7f6e offset\uff0cBroker \u548c consumer \u90fd\u4f1a\u91cd\u7f6e<\/h4> \n
\n
bin\/mqadmin resetOffsetByTime -n 10.49<\/span>.196.33<\/span>:9876<\/span> -b broker-a -t TEST_TOPIC -g myGroup -s 2023<\/span>-08<\/span>-10<\/span>#10<\/span>:09<\/span>:22<\/span>:000<\/span><\/pre> \n <\/div> \n 

2.4\u3001\u6d88\u8d39\u76f8\u5173<\/h3> \n

2.4.1\u3001\u67e5\u770b\u8ba2\u9605\u7ec4\u6d88\u8d39\u72b6\u6001<\/h4> \n
\n
bin\/mqadmin consumerProgress -n 10.49<\/span>.196.33<\/span>:9876<\/span> -g myGroup<\/pre> \n <\/div> \n 

2.4.2\u3001\u67e5\u770b\u6d88\u8d39\u8005\u72b6\u6001<\/h4> \n
\n
bin\/mqadmin consumerStatus -n 10.49<\/span>.196.33<\/span>:9876<\/span> -g myGroup<\/pre> \n <\/div> \n 

\u6539\u547d\u4ee4\u4f1a\u62a5\u8fde\u63a5\u4e0d\u4e0a\u5ba2\u6237\u7aef\u7684\u9519\u8bef\uff1asend request to <10.49.196.1:55642> failed\u3002<\/p> \n

2.4.3\u3001\u66f4\u65b0\u6216\u521b\u5efa\u8ba2\u9605\u5173\u7cfb<\/h4> \n
\n
bin\/mqadmin updateSubGroup -n 10.49<\/span>.196.33<\/span>:9876<\/span> -g myGroup2 -b 10.49<\/span>.196.33<\/span>:10911<\/span><\/pre> \n <\/div> \n 

2.4.4\u3001\u4ece Broker \u5220\u9664\u8ba2\u9605\u5173\u7cfb<\/h4> \n
\n
bin\/mqadmin deleteSubGroup -n 10.49<\/span>.196.33<\/span>:9876<\/span> -g myGroup2 -b 10.49<\/span>.196.33<\/span>:10911<\/span><\/pre> \n <\/div> \n 

2.4.5\u3001\u5728\u76ee\u6807\u7fa4\u7ec4\u4e2d\u4f7f\u7528\u6e90\u7fa4\u7ec4\u7684 offset<\/h4> \n
\n
bin\/mqadmin cloneGroupOffset -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC -s myGroup -d myGroup2<\/pre> \n <\/div> \n 

2.5\u3001\u8fde\u63a5\u76f8\u5173<\/h3> \n

2.5.1\u3001\u67e5\u8be2 Consumer \u7684\u7f51\u7edc\u8fde\u63a5<\/h4> \n
\n
bin\/mqadmin consumerConnection -n 10.49<\/span>.196.33<\/span>:9876<\/span> -g myGroup<\/pre> \n <\/div> \n 

2.5.2\u3001\u67e5\u8be2 Producer \u7684\u7f51\u7edc\u8fde\u63a5<\/h4> \n
\n
bin\/mqadmin producerConnection -n 10.49<\/span>.196.33<\/span>:9876<\/span> -t TEST_TOPIC -g producerGroup<\/pre> \n <\/div> \n 

\u4ece 5.x \u7248\u672c\u5f00\u59cb\uff0c\u751f\u4ea7\u8005\u662f\u533f\u540d\u7684\uff0c\u65e0\u9700\u7ba1\u7406\u751f\u4ea7\u8005\u5206\u7ec4\uff1b\u56e0\u6b64 5.x \u7248\u672c\u65e0\u6cd5\u4f7f\u7528\u8be5\u547d\u4ee4\u3002<\/p> \n

2.6\u3001NameS","orderid":"0","title":"RocketMQ \u5165\u95e8\u5b9e\u6218(3)--Admin Tool \u4ecb\u7ecd(\u4e00)","smalltitle":"","mid":"0","fname":"JAVA","special_id":"0","bak_id":"0","info":"0","hits":"229","pages":"2","comments":"0","posttime":"2023-09-23 15:44:45","list":"1695455085","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"RocketMQ<\/A> --Admin<\/A> Tool<\/A> \u4ecb\u7ecd<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"112.94.1.100","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"RocketMQ \u5165\u95e8\u5b9e\u6218(3)--Admin Tool \u4ecb\u7ecd","lastview":"1713310080","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}