Instructions on the use of mqadmin Management tools

Before introducing the mqadmin management tool, the following points need to be declared:

  • The way of executing a command is:./mqadmin {command} {args}
  • Almost all commands need to attach the -n option to represent the nameServer address, formatted as ip:port;
  • Almost all commands can get help information with the -h option;
  • If the broker address -b option and clusterName -c option are both configured with specific values, the command execution will select the broker address specified by -b option. The value of the -b option can only be configured with a single address. The format is ip:port. The default port value is 10911. If the value of the -b option is not configured, the command will be applied to all brokers in the entire cluster.
  • You can see many commands under tools, but not all commands can be used, only the commands initialized in MQAdminStartup can be used, you can also modify this class, add or customize commands;
  • Due to the issue of version update, a small number of commands may not be updated in time, please read the related command source code to eliminate and resolve the error.

1 Topic related command instructions

NameMeaningCommand optionExplain
updateTopicCreate or update the configuration of topic-bThe -b option declares the specific address of the broker, indicating that the broker, in which the topic is located supports only a single broker and the address format is ip:port.
-cThe -c option declares the name of the cluster, which represents the cluster in which the current topic is located. (clusters are available through clusterList query)
-h-Print help information
-nDeclare the service address of the nameServer, and the option format is ip:port
-pThe -p option is used to specify the read and write permission for the new topic (W=2 | R=4 | WR=6)
-rThe -r option declares the number of readable queues (default 8)
-wThe -w option declares the number of writable queues (default 8)
-tThe -t option declares the name of the topic (the name can only use characters^ [a-zA-Z0-9s -] + $)
deleteTopicDelete the topic command-cThe -c option specifies the name of the cluster, which means that one of the topic in the specified cluster is deleted (cluster names can be queried via clusterList)
-hPrint help information
-nDeclare the service address of the nameServer, and the option format is ip:port
-tThe -t option declares the name of the topic (the name can only use characters^ [a-zA-Z0-9s -] + $)
topicListView topic list information-hPrint help information
-cIf the -c option is not configured, only the topic list is returned, and the addition of -c option returns additional information about the clusterName, topic, consumerGroup, that is, the cluster and subscription to which the topic belongs, and no other option need to be configured.
-nDeclare the service address of the nameServer, and the option format is ip:port
topicRouteTo view topic specific routing information-tUsed to specify the name of the topic
-hPrint help information
-nDeclare the service address of the nameServer, and the option format is ip:port
topicStatusThe location of the offset used to view the topic message queue-tUsed to specify the name of the topic
-hPrint help information
-nDeclare the service address of the nameServer, and the option format is ip:port
topicClusterListTo view the list of clusters to which topic belongs-tUsed to specify the name of the topic
-hPrint help information
-nDeclare the service address of the nameServer, and the option format is ip:port
updateTopicPermThis command is used to update read and write permissions for topic-tUsed to specify the name of the topic
-hPrint help information
-nDeclare the service address of the nameServer, and the option format is ip:port
-bThe -b option declares the specific address of the broker, indicating that the broker, in which the topic is located supports only a single broker and the address format is ip:port.
-pThe -p option is used to specify the read and write permission for the new topic (W=2 | R=4 | WR=6)
-cUsed to specify the name of the cluster that represents the cluster in which the topic is located, which can be accessed through the clusterList query, but the -b parameter has a higher priority, and if no -b option related configuration is specified, the command is executed on all broker in the cluster
updateOrderConfThe key, value configuration that creates, deletes, and retrieves specific namespaces from nameServer is not yet enabled.-hPrint help information
-nDeclare the service address of the nameServer, and the option format is ip:port
-ttopic,key
-vorderConf,value
-mmethod,available values include get, put, delete
allocateMQComputing load result of load message queue in consumer list with average load algorithm-tUsed to specify the name of the topic
-hPrint help information
-nDeclare the service address of the nameServer, and the option format is ip:port
-iIpList, is separated by commas to calculate which message queues these ip unload topic
statsAllFor printing topic subscription, TPS, cumulative amount, 24 hours read and write total, etc.-hPrint help information
-nDeclare the service address of the nameServer, and the option format is ip:port
-aWhether to print only active topic
-tUsed to specify the name of the topic

2 Cluster related command instructions

NameMeaningCommand optionExplain
clusterListView cluster information, cluster, brokerName, brokerId, TPS, and so on-mPrint more information (add print to # InTotalYest, #OutTotalYest, #InTotalToday ,#OutTotalToday)
-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
-iPrint interval,unit basis is seconds
clusterRTSend message to detect each broker RT of the cluster.the message send to ${BrokerName} Topic-aamount,total number per probe,RT = Total time/amount
-sMessage size,unit basis is B
-cWhich cluster to detect.
-pWhether to print the formatted log,split with "|", not printed by default
-hPrint help information
-mOwned computer room for printing
-iThe interval, in seconds, at which a message is sent.
-nService address used to specify nameServer and formatted as ip:port

3 Broker related command instructions

NameMeaningCommand optionExplain
updateBrokerConfigThe configuration information used to update the broker and the contents of the Broker.conf file are modified-bDeclare the address of the broker and format as ip:port
-cSpecify the name of the cluster
-kthe value of k
-vthe value of value
-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
brokerStatusFor viewing broker related statistics and running status (almost all the information you want is inside)-bDeclare the address of the broker and format as ip:port
-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
brokerConsumeStatsGet the consumption of each consumer in broker and return information such as consume Offset,broker Offset,diff,timestamp by message queue dimension-bDeclare the address of the broker and format as ip:port
-tConfigure the timeout of the request
-lConfigure the diff threshold beyond which to print
-oSpecifies whether the order topic, is typically false
-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
getBrokerConfigGet configuration information for the broker-bDeclare the address of the broker and format as ip:port
-nService address used to specify nameServer and formatted as ip:port
wipeWritePermClear write permissions for broker from nameServer-bDeclare the BrokerName
-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
cleanExpiredCQClean up expired consume Queue on broker,An expired queue may be generated if the number of columns is reduced manually-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
-bDeclare the address of the broker and format as ip:port
-cUsed to specify the name of the cluster
cleanUnusedTopicClean up unused topic on broker and release topic's consume Queue from memory,If the topic is removed manually, an unused topic will be generated-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
-bDeclare the address of the broker and format as ip:port
-cUsed to specify the name of the cluster
sendMsgStatusSend a message to the broker and then return the send status and RT-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
-bbrokerName,note that this is not broker's address
-sMessage size,the unit of account is B
-cNumber of messages sent

4 Message related command instructions

NameMeaningCommand optionExplain
queryMsgByIdQuery msg according to offsetMsgId. If you use open source console, you should use offsetMsgId. There are other parameters for this command. For details, please read QueryMsgByIdSubCommand.-imsgId
-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
queryMsgByKeyQuery messages based on message Key-kmsgKey
-tThe name of the topic
-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
queryMsgByOffsetQuery messages based on Offset-bThe name of broker,(Note here: the name of broker is filled in, not the address of broker, and the broker name can be found in clusterList)
-iQueue id of the query
-oThe value of offset
-tThe name of the topic
-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
queryMsgByUniqueKeyAccording to the msgId query, msgId is different from offsetMsgId. The specific differences can be found in common operational and maintenance problems. "-g" option and "-d" option are to be used together, and when you find the message, try to get a particular consumer to consume the message and return the result of the consumption.-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
-iuniqe msg id
-gconsumerGroup
-dclientId
-tThe name of the topic
checkMsgSendRTDetect RT to send a message to topic, function similar to clusterRT-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
-tThe name of the topic
-athe number of probes
-sThe size of message
sendMessageSend a message that can be sent, as configured, to a particular message Queue, or to a normal send.-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
-tThe name of the topic
-pbody,message body
-kkeys
-ctags
-bbrokerName
-iqueueId
consumeMessageConsumer messages. You can consume messages based on offset, start timestamps, end timestamps, message queues, and configure different consumption logic for different execution, as detailed in ConsumeMessageCommand.-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
-tThe name of the topic
-bbrokerName
-oStart consumption from offset
-iqueueId
-gGroup of consumers
-sSpecify a start timestamp in a format see -h
-dSpecify a end timestamp
-cSpecify how many messages to consume
printMsgConsume messages from broker and print them, optional time periods-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
-tThe name of the topic
-cCharacter set,for example UTF-8
-ssubExpress,filter expression
-bSpecify a start timestamp in a format see -h
-eSpecify the end timestamp
-dWhether to print the message body
printMsgByQueueSimilar to printMsg, but specifying message queue-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
-tThe name of the topic
-iqueueId
-abrokerName
-cCharacter set,for example UTF-8
-ssubExpress,filter expression
-bSpecify a start timestamp in a format see -h
-eSpecify the end timestamp
-pWhether to print a message
-dWhether to print the message body
-fWhether to count the number of tags and print
resetOffsetByTimeReset both offset,broker and consumer by timestamp-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
-gGroup of consumers
-tThe name of the topic
-sResets the offset corresponding to this timestamp
-fWhether to force a reset, if set to false, only supports backtracking offset, if it is true, regardless of the relationship between offset and consume Offset with the timestamp
-cWhether to reset the C++ client offset

5 Consumer and Consumer Group related command instructions

NameMeaningCommand optionExplain
consumerProgressTo view the subscriber consumption status, you can see the amount of message accumulation for a specific client IP-gThe group name of consumer
-sWhether to print client IP
-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
consumerStatusSee the consumer status, including whether the same subscription is in the same group, analyze whether the process queue is stacked, return the consumer jstack results, more content, and see ConsumerStatusSubCommand for the user-hPrint help information
-nService address used to specify nameServer and formatted as ip:port
-gconsumer group
-iclientId
-sWhether to execute jstack
getConsumerStatusGet Consumer consumption progress-gthe group name of consumer
-tQuery topic
-iIp address of consumer client
-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
updateSubGroupUpdate or create a subscription-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
-bthe address of broker
-cThe name of cluster
-gThe group name of consumer
-sWhether the group is allowed to consume
-mWhether to start consumption from the minimum offset
-dIs it a broadcast mode
-qThe Number of retry queues
-rMaximum number of retries
-iWhen the slaveReadEnable is on and which brokerId consumption is recommended for consumption from slave, the brokerid of slave, can be configured to consume from the slave actively
-wIf broker recommends consumption from slave, configuration determines which slave consumption to consume from, and configure a specific brokerId, such as 1
-aWhether to notify other consumers of load balancing when the number of consumers changes
deleteSubGroupRemove subscriptions from broker-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
-bthe address of broker
-cThe name of cluster
-gThe group name of consumer
cloneGroupOffsetUse the offset of the source group in the target group-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
-sSource consumer group
-dTarget consumer group
-tThe name of topic
-oNot used yet

6 Connection related command instructions

NameMeaningCommand optionExplain
consumerConnectionQuery the network connection of consumer-gThe group name of consumer
-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
producerConnectionQuery the network connection of producer-gthe group name of producer
-tThe name of topic
-nService address used to specify nameServer and formatted as ip:port
-hPrint help information

7 NameServer related command instructions

NameMeaningCommand optionExplain
updateKvConfigUpdate the kv configuration of nameServer, which is not currently used-sSpecify a specific namespace
-kkey
-vvalue
-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
deleteKvConfigDelete the kv configuration of nameServer-sSpecify a specific namespace
-kkey
-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
getNamesrvConfigGet the configuration of the nameServer-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
updateNamesrvConfigModifying the configuration of nameServer-nService address used to specify nameServer and formatted as ip:port
-hPrint help information
-kThe value of key
-vThe value of value

8 Other relevant command notes

NameMeaningCommand optionExplain
startMonitoringUsed to start the monitoring process, monitor message deletion, retry queue messages, etc.-nService address used to specify nameServer and formatted as ip:port
-hPrint help information