Skip to main content
Version: 4.x

Admin Tool

Notice
  1. To execute a command: ./mqadmin {command} {args}
  2. Most commands require the configuration of the NameServer address with the -n flag, in the format ip:port
  3. Most commands can get help with the -h flag
  4. If both the Broker address (-b) and the clusterName (-c) are configured, the command will be executed using the Broker address. If the Broker address is not configured, the command will be executed on all hosts in the cluster. Only one Broker address is supported, in the format ip:port, where the port is 10911 by default.
  5. In the tools directory, you can see many commands, but not all of them can be used. Only those initialized in MQAdminStartup can be used. You can also modify this class to add or define your own commands.
  6. Some commands may not have been updated due to version updates, and may cause errors. In this case, please read the relevant command source code.
Topic-related parameters
NameDefinitionCommand optionsExplain
updateTopicCreate/update topic configuration-bBroker address, representing the Broker where the topic is located. Only a single Broker is supported, with the address in the format ip:port.
-cCluster name, representing the cluster where the topic is located (the cluster can be queried with the clusterList command).
-hPrint help
-nNameServer address,format ip:port
-pSpecify the read-write permissions for the new topic( W=2|R=4|WR=6 )
-rNumber of readable queues(default is 8)
-wNumber of writable queues(default is 8)
-tTopic name (the name can only use the characters ^[a-zA-Z0-9_-]+$ )
deleteTopicDelete Topic-cCluster name, representing the deletion of a specific topic under a certain cluster (the cluster can be queried with the clusterList command).
-hPrint help
-nNameServer address,format ip:port
-ttopic name (the name can only use the characters ^[a-zA-Z0-9_-]+$ )
topicListQuery topic list information-hPrint help
-cWithout the -c flag, only the topic list is returned. Adding -c returns the clusterName, topic, and consumerGroup information, i.e. the cluster that the topic belongs to and the subscription relationship. There are no parameters.
-nNameServer address,format ip:port
topicRouteQuery topic routing information-ttopic name
-hPrint help
-nNameServer address,format ip:port
topicStatusQuery topic message queue offsets-ttopic name
-hPrint help
-nNameServer address,format ip:port
topicClusterListQuery list of clusters where the topic is located-ttopic name
-hPrint help
-nNameServer address,format ip:port
updateTopicPermUpdate topic read-write permissions-ttopic name
-hPrint help
-nNameServer address,format ip:port
-bBroker address, representing the Broker where the topic is located. Only a single Broker is supported, with the address in the format ip:port.
-pSpecify the read-write permissions for the new topic( W=2|R=4|WR=6 )
-cCluster name, representing the cluster where the topic is located (the cluster can be queried with the clusterList command). The -b flag takes precedence. If there is no -b flag, the command will be executed on all Brokers in the cluster.
updateOrderConfCreate, delete, and get specific kv configurations from the NameServer. This feature is currently not available.-hPrint help
-nNameServer address,format ip:port
-ttopic,key
-vorderConf,value
-mmethod,optional get、put、delete
allocateMQCalculate the load results of the message queue for the consumer list using an average load algorithm.-ttopic name
-hPrint help
-nNameServer address,format ip:port
-iipList,separated by commas, calculates the message queue load for these IPs for the topic.
statsAllPrint information about the topic's subscriptions, TPS, accumulation, 24-hour total read-write volume, etc.-hPrint help
-nNameServer address,format ip:port
-aPrint only active topics
-tSpecify topic
Cluster-related parameters
NameDefinitionCommand optionsExplain
clusterListQuery cluster information, including the cluster, BrokerName, BrokerId, TPS, and other information.-mPrint more information (additional information printed includes: #InTotalYest, #OutTotalYest,#InTotalToday ,#OutTotalToday)
-hPrint help
-nNameServer address,format ip:port
-iPrint interval, in seconds.
clusterRTSend a message to test the RT of each Broker in the cluster. The message is sent to the${BrokerName} Topic。-aamount,the total number of probes each time. RT = total time / amount
-sMessage size,Unit: B
-cWhich cluster to probe
-pWhether to print formatted logs, separated by |, default is not printed.
-hPrint help
-mBelonging datacenter, for printing purposes.
-iSend interval,in seconds.
-nNameServer address,format ip:port
Broker-related parameters
NameDefinitionCommand optionsExplain
queryMsgByIdQuery the msg based on offsetMsgId. If using the open source console, offsetMsgId should be used. This command has additional parameters, for more information on their function, please read QueryMsgByIdSubCommand.-imsgId
-hPrint help
-nNameServer address,format ip:port
queryMsgByKeyQuery message based on message key.-kmsgKey
-tTopic name
-hPrint help
-nNameServer address,format ip:port
queryMsgByOffsetQuery message based on offset.-bBroker name (note that the name of the Broker, not its address, should be entered here. The Broker name can be found using the clusterList command).
-iquery queue id
-ooffset value
-ttopic name
-hPrint help
-nNameServer address,format ip:port
queryMsgByUniqueKeyQuery based on msgId. msgId is different from offsetMsgId, for more information see common operations issues. -g and -d are used together, after finding the message, try to let a specific consumer consume the message and return the consumption result.-hPrint help
-nNameServer address,format ip:port
-iuniqe msg id
-gconsumerGroup
-dclientId
-ttopic name
checkMsgSendRTCheck the RT of sending messages to a topic. The function is similar to clusterRT.-hPrint help
-n NameServer address,format ip:port
-ttopic name
-aNumber of probes
-smessage size
sendMessageSend a message, which can be sent to a specific message queue based on configuration, or a normal send.-hPrint help
-nNameServer address,format ip:port
-ttopic name
-pmessage body
-kkeys
-ctags
-bBrokerName
-iqueueId
consumeMessageConsume messages. Messages can be consumed based on offset, start & end timestamps, and message queues. Different configurations execute different consumption logic, see ConsumeMessageCommand for more information.-hPrint help
-nNameServer address,format ip:port
-ttopic name
-bBrokerName
-oConsume from offset
-iqueueId
-gConsumer group
-sStart timestamp, see -h for format.
-dEnd timestamp
-cConsume a certain number of messages
printMsgConsume messages from Broker and print them, optional time period.-hPrint help
-nNameServer address,format ip:port
-ttopic name
-cCharacter set, e.g. UTF-8
-ssubExpress,filter expression
-bStart timestamp, see -h for format.
-eEnd timestamp
-dWhether to print the message body.
printMsgByQueueSimilar to printMsg, but for a specific message queue.-hPrint help
-nNameServer address,format ip:port
-ttopic name
-iqueueId
-aBrokerName
-cCharacter set, e.g. UTF-8
-ssubExpress, filter expression
-bStart timestamp, see -h for format.
-eEnd timestamp
-pWhether to print the message body.
-dWhether to print the message body.
-fWhether to count and print the number of tags
resetOffsetByTimeReset offset based on timestamp, both Broker and consumer will be reset.-hPrint help
-nNameServer address, format ip:port
-gConsumer group
-ttopic name
-sReset to the offset corresponding to this timestamp.
-fWhether to force reset. If false, only backward offset is supported. If true, regardless of the relationship between the timestamp-corresponding offset and consumeOffset.
-cWhether to reset the offset for the C++ client.
Message-related parameters
NameDefinitionCommand optionsExplain
queryMsgByIdTo query a message by its offset message ID (offsetMsgId), you can use the offsetMsgId command if using an open source console. This command has additional parameters, the specific function of which can be found by reading the QueryMsgByIdSubCommand.-imsgId
-hPrint help
-nNameServer address,format ip:port
queryMsgByKeyQuery a message by key.-kmsgKey
-tTopic name
-hPrint help
-nNameServer address,format ip:port
queryMsgByOffsetQuery a message by offset-bBroker name (Note that this should be the name of the Broker, not the address. The name of the Broker can be found in clusterList.)
-iquery queue id
-ooffset value
-ttopic name
-hPrint help
-nNameServer address,format ip:port
queryMsgByUniqueKeyQuery based on msgId. Note that msgId is different from offsetMsgId. For more information, see Common Operations and Maintenance Issues. Use -g and -d together to try to have a specific consumer consume the message and return the consumption result once the message has been found.-hPrint help
-nNameServer address,format ip:port
-iuniqe msg id
-gconsumerGroup
-dclientId
-ttopic name
checkMsgSendRTCheck the RT (round-trip time) for sending messages to a topic. This function is similar to clusterRT.-hPrint help
-n NameServer address,format ip:port
-ttopic name
-aNumber of probes.
-sMessage size
sendMessageSend a message, which can be sent to a specific Message Queue according to configuration or sent normally.-hPrint help
-nNameServer address,format ip:port
-ttopic name
-pbody,message body
-kkeys
-ctags
-bBrokerName
-iqueueId
consumeMessageConsume messages. Messages can be consumed based on offset, start & end timestamps, and message queue. Different configurations will execute different consumption logic. See ConsumeMessageCommand for more information.-hPrint help
-nNameServer address,format ip:port
-ttopic name
-bBrokerName
-oConsume from a specified offset.
-iqueueId
-gConsumer group
-sStart timestamp, see -h for format.
-dEnd timestamp
-cConsume a specified number of messages.
printMsgConsume and print messages from the Broker within a specified time period.-hPrint help
-nNameServer address,format ip:port
-ttopic name
-cCharacter set, e.g. UTF-8
-ssubExpress,filter expression
-bStart timestamp, see -h for format.
-eEnd timestamp
-dWhether to print message body
printMsgByQueueSimilar to printMsg, but specifies a Message Queue.-hPrint help
-nNameServer address,format ip:port
-ttopic name
-iqueueId
-aBrokerName
-cCharacter set, e.g. UTF-8
-ssubExpress,filter expression
-bStart timestamp, see -h for format.
-eEnd timestamp
-pWhether to print the message
-dWhether to print the message body
-fWhether to count and print the number of tags
resetOffsetByTimeResetting the offset by timestamp will reset both the broker and the consumer.-hPrint help
-nNameServer address, format ip:port
-gConsumer group
-ttopic name
-sReset to the offset corresponding to this timestamp.
-fWhether to force reset. If false, only backward offset is supported. If true, the relationship between the timestamp corresponding offset and consumeOffset is ignored.
-cWhether to reset the offset for the C++ client.
Consume-related parameters
NameDefinitationCommand optionsExplain
consumerProgressConsumer group consumption status, including specific client IP's message accumulation.-gconsumer group name
-sWhether to print the client IP.
-hPirnt help
-nNameServer address,format ip:port
consumerStatusConsumer status refers to the status of a consumer, including whether all consumers in the same group have the same subscriptions, whether the Process Queue is stacking up, and the jstack result of the consumer. The information returned by this command is extensive, and users should refer to the ConsumerStatusSubCommand for more details.-hPrint help
-nNameServer address,format ip:port
-gconsumer group
-iclientId
-sWhether to execute jstack
getConsumerStatusGet Consumer consumption progress-gConsumer group name
-tQuery topic
-iConsumer client ip
-nNameServer address,format ip:port
-hPrint help
updateSubGroupUpdate or create a subscription relationship.-nNameServer address,format ip:port
-hPrint help
-bBroker address
-cCluster name
-gConsumer group name
-swhether the group is allowed to consume
-mWhether to start consuming from the smallest offset.
-dWhether it is broadcast mode.
-qNumber of retry queues.
-rMaximum number of retries
-iWhen slaveReadEnable is turned on and it has not yet reached the point where it is recommended to consume from the slave, it is possible to configure the standby machine id to actively consume from the standby machine.
-wIf the Broker suggests consuming from the slave, the configuration determines which slave to consume from. The BrokerId can be configured, for example 1.
-aWhether other consumers are notified of load balancing when the number of consumers changes.
deleteSubGroupTo remove a subscription from a Broker-nNameServer address,format ip:port
-hPrint help
-bBroker address
-cCluster name
-gCounsumer group name
cloneGroupOffsetUsing the offsets from the source consumer group in the target consumer group.-nNameServer address,format ip:port
-hPrint help
-sSource consumer group
-dTarget consumer group
-ttopicname
-oNot currently in use.
Connection-related parameters
NameDefinitionCommand optionsExplain
consumerConnec tionQuery consumer network connections.-gName of consumer group.
-nNameServer address,format ip:port
-hPrint help
producerConnec tionQuery producer network connections.-gName of producer group.
-ttopic name
-nNameServer address,format ip:port
-hPrint help
Connection-related parameters
NameDefinitionCommand optionsExplain
updateKvConfigUpdate NameServer KV configuration, currently not in use.-sName space
-kkey
-vvalue
-nNameServer address,format ip:port
-hPrint help
deleteKvConfigDelete NameServer KV configuration.-sName space
-kkey
-nNameServer address,format ip:port
-hPrint help
getNamesrvConfigGet NameServer configuration.-nNameServer address,format ip:port
-hPrint help
updateNamesrvConfigModify NameServer configuration.-nNameServer address,format ip:port
-hPrint help
-kkey
-vvalue

Others

Connection-related parameters
NameDefinitionCommand optionsExplain
startMonitoringStart the monitoring process to monitor events such as message deletion errors and the number of messages in the retry queue.-nNameServer address,format ip:port
-hPrint help