# 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
Name |
Meaning |
Command option |
Explain |
updateTopic |
Create or update the configuration of topic |
-b |
The -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. |
-c |
The -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 |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
-p |
The -p option is used to specify the read and write permission for the new topic (W=2 | R=4 | WR=6) |
-r |
The -r option declares the number of readable queues (default 8) |
-w |
The -w option declares the number of writable queues (default 8) |
-t |
The -t option declares the name of the topic (the name can only use characters^ [a-zA-Z0-9s -] + $) |
deleteTopic |
Delete the topic command |
-c |
The -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) |
-h |
Print help information |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
-t |
The -t option declares the name of the topic (the name can only use characters^ [a-zA-Z0-9s -] + $) |
topicList |
View topic list information |
-h |
Print help information |
-c |
If 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. |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
topicRoute |
To view topic specific routing information |
-t |
Used to specify the name of the topic |
-h |
Print help information |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
topicStatus |
The location of the offset used to view the topic message queue |
-t |
Used to specify the name of the topic |
-h |
Print help information |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
topicClusterList |
To view the list of clusters to which topic belongs |
-t |
Used to specify the name of the topic |
-h |
Print help information |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
updateTopicPerm |
This command is used to update read and write permissions for topic |
-t |
Used to specify the name of the topic |
-h |
Print help information |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
-b |
The -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. |
-p |
The -p option is used to specify the read and write permission for the new topic (W=2 | R=4 | WR=6) |
-c |
Used 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 |
updateOrderConf |
The key, value configuration that creates, deletes, and retrieves specific namespaces from nameServer is not yet enabled. |
-h |
Print help information |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
-t |
topic,key |
-v |
orderConf,value |
-m |
method,available values include get, put, delete |
allocateMQ |
Computing load result of load message queue in consumer list with average load algorithm |
-t |
Used to specify the name of the topic |
-h |
Print help information |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
-i |
IpList, is separated by commas to calculate which message queues these ip unload topic |
statsAll |
For printing topic subscription, TPS, cumulative amount, 24 hours read and write total, etc. |
-h |
Print help information |
-n |
Declare the service address of the nameServer, and the option format is ip:port |
-a |
Whether to print only active topic |
-t |
Used to specify the name of the topic |
## 2 Cluster related command instructions
####
Name |
Meaning |
Command option |
Explain |
clusterList |
View cluster information, cluster, brokerName, brokerId, TPS, and so on |
-m |
Print more information (add print to # InTotalYest,
#OutTotalYest, #InTotalToday ,#OutTotalToday) |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
-i |
Print interval,unit basis is seconds |
clusterRT |
Send message to detect each broker RT of the cluster.the message send to ${BrokerName} Topic |
-a |
amount,total number per probe,RT = Total time/amount |
-s |
Message size,unit basis is B |
-c |
Which cluster to detect. |
-p |
Whether to print the formatted log,split with "|", not printed by default |
-h |
Print help information |
-m |
Owned computer room for printing |
-i |
The interval, in seconds, at which a message is sent. |
-n |
Service address used to specify nameServer and formatted as ip:port |
## 3 Broker related command instructions
Name |
Meaning |
Command option |
Explain |
updateBrokerConfig |
The configuration information used to update the broker and the contents of the Broker.conf file are modified |
-b |
Declare the address of the broker and format as ip:port |
-c |
Specify the name of the cluster |
-k |
the value of k |
-v |
the value of value |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
brokerStatus |
For viewing broker related statistics and running status (almost all the information you want is inside) |
-b |
Declare the address of the broker and format as ip:port |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
brokerConsumeStats |
Get the consumption of each consumer in broker and return information such as consume Offset,broker Offset,diff,timestamp by message queue dimension |
-b |
Declare the address of the broker and format as ip:port |
-t |
Configure the timeout of the request |
-l |
Configure the diff threshold beyond which to print |
-o |
Specifies whether the order topic, is typically false |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
getBrokerConfig |
Get configuration information for the broker |
-b |
Declare the address of the broker and format as ip:port |
-n |
Service address used to specify nameServer and formatted as ip:port |
wipeWritePerm |
Clear write permissions for broker from nameServer |
-b |
Declare the BrokerName |
addWritePerm |
Add write permissions for broker from nameServer |
-b |
Declare the BrokerName |
-n |
Service address used to specify nameServer and formatted as ip:port |
-h |
Print help information |
cleanExpiredCQ |
Clean up expired consume Queue on broker,An expired queue may be generated if the number of columns is reduced manually |
-n |
Service address used to specify nameServer and formatted as ip:port |
-h |
Print help information |
-b |
Declare the address of the broker and format as ip:port |
-c |
Used to specify the name of the cluster |
cleanUnusedTopic |
Clean 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 |
-n |
Service address used to specify nameServer and formatted as ip:port |
-h |
Print help information |
-b |
Declare the address of the broker and format as ip:port |
-c |
Used to specify the name of the cluster |
sendMsgStatus |
Send a message to the broker and then return the send status and RT |
-n |
Service address used to specify nameServer and formatted as ip:port |
-h |
Print help information |
-b |
brokerName,note that this is not broker's address |
-s |
Message size,the unit of account is B |
-c |
Number of messages sent |
## 4 Message related command instructions
####
Name |
Meaning |
Command option |
Explain |
queryMsgById |
Query 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.
|
-i |
msgId |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
queryMsgByKey |
Query messages based on message Key |
-k |
msgKey |
-t |
The name of the topic |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
queryMsgByOffset |
Query messages based on Offset |
-b |
The 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) |
-i |
Queue id of the query |
-o |
The value of offset |
-t |
The name of the topic |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
queryMsgByUniqueKey |
According 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. |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
-i |
uniqe msg id |
-g |
consumerGroup |
-d |
clientId |
-t |
The name of the topic |
checkMsgSendRT |
Detect RT to send a message to topic, function similar to clusterRT |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
-t |
The name of the topic |
-a |
the number of probes |
-s |
The size of message |
sendMessage |
Send a message that can be sent, as configured, to a particular message Queue, or to a normal send. |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
-t |
The name of the topic |
-p |
body,message body |
-k |
keys |
-c |
tags |
-b |
brokerName |
-i |
queueId |
consumeMessage |
Consumer 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. |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
-t |
The name of the topic |
-b |
brokerName |
-o |
Start consumption from offset |
-i |
queueId |
-g |
Group of consumers |
-s |
Specify a start timestamp in a format see -h |
-d |
Specify a end timestamp |
-c |
Specify how many messages to consume |
printMsg |
Consume messages from broker and print them, optional time periods |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
-t |
The name of the topic |
-c |
Character set,for example UTF-8 |
-s |
subExpress,filter expression |
-b |
Specify a start timestamp in a format see -h |
-e |
Specify the end timestamp |
-d |
Whether to print the message body |
printMsgByQueue |
Similar to printMsg, but specifying message queue |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
-t |
The name of the topic |
-i |
queueId |
-a |
brokerName |
-c |
Character set,for example UTF-8 |
-s |
subExpress,filter expression |
-b |
Specify a start timestamp in a format see -h |
-e |
Specify the end timestamp |
-p |
Whether to print a message |
-d |
Whether to print the message body |
-f |
Whether to count the number of tags and print
|
resetOffsetByTime |
Reset both offset,broker and consumer by timestamp |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
-g |
Group of consumers |
-t |
The name of the topic |
-s |
Resets the offset corresponding to this timestamp |
-f |
Whether 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 |
-c |
Whether to reset the C++ client offset |
## 5 Consumer and Consumer Group related command instructions
####
Name |
Meaning |
Command option |
Explain |
consumerProgress |
To view the subscriber consumption status, you can see the amount of message accumulation for a specific client IP |
-g |
The group name of consumer |
-s |
Whether to print client IP |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
consumerStatus |
See 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 |
-h |
Print help information |
-n |
Service address used to specify nameServer and formatted as ip:port |
-g |
consumer group |
-i |
clientId |
-s |
Whether to execute jstack |
getConsumerStatus |
Get Consumer consumption progress |
-g |
the group name of consumer |
-t |
Query topic |
-i |
Ip address of consumer client |
-n |
Service address used to specify nameServer and formatted as ip:port |
-h |
Print help information |
updateSubGroup |
Update or create a subscription |
-n |
Service address used to specify nameServer and formatted as ip:port |
-h |
Print help information |
-b |
the address of broker |
-c |
The name of cluster |
-g |
The group name of consumer |
-s |
Whether the group is allowed to consume |
-m |
Whether to start consumption from the minimum offset |
-d |
Is it a broadcast mode |
-q |
The Number of retry queues |
-r |
Maximum number of retries |
-i |
When 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 |
-w |
If broker recommends consumption from slave, configuration determines which slave consumption to consume from, and configure a specific brokerId, such as 1 |
-a |
Whether to notify other consumers of load balancing when the number of consumers changes |
deleteSubGroup |
Remove subscriptions from broker |
-n |
Service address used to specify nameServer and formatted as ip:port |
-h |
Print help information |
-b |
the address of broker |
-c |
The name of cluster |
-g |
The group name of consumer |
cloneGroupOffset |
Use the offset of the source group in the target group
|
-n |
Service address used to specify nameServer and formatted as ip:port |
-h |
Print help information |
-s |
Source consumer group |
-d |
Target consumer group |
-t |
The name of topic |
-o |
Not used yet |
## 6 Connection related command instructions
####