Use of mqadmin command

Use of mqadmin command


F:\rocketmq-all-4.9.7-bin-release\bin>mqadmin
The most commonly used mqadmin commands are:
updateTopic Update or create topic
deleteTopic Delete topic from broker and NameServer.
updateSubGroup Update or create subscription group
deleteSubGroup Delete subscription group from broker.
updateBrokerConfig Update broker’s config
updateTopicPerm Update topic perm
topicRoute Examine topic route info
topicStatus Examine topic Status info
topicClusterList get cluster info for topic
brokerStatus Fetch broker runtime status data
queryMsgById Query Message by Id
queryMsgByKey Query Message by Key
queryMsgByUniqueKey Query Message by Unique key
queryMsgByOffset Query Message by offset
queryMsgTraceById query a message trace
printMsg Print Message Detail
printMsgByQueue Print Message Detail
sendMsgStatus send msg to broker.
brokerConsumeStats Fetch broker consume stats data
producerConnection Query producer’s socket connection and client version
consumerConnection Query consumer’s socket connection, client version and subscription
consumerProgress Query consumers’s progress, speed
consumerStatus Query consumer’s internal data structure
cloneGroupOffset clone offset from other group.
producer Query producer’s instances, connection, status, etc.
clusterList List all of clusters
topicList Fetch all topic list from name server
updateKvConfig Create or update KV config.
deleteKvConfig Delete KV config.
wipeWritePerm Wipe write perm of broker in all name server you defined in the -n param
addWritePerm Add write perm of broker in all name server you defined in the -n param
resetOffsetByTime Reset consumer offset by timestamp(without client restart).
skipAccumulatedMessage Skip all messages that are accumulated (not consumed) currently
updateOrderConf Create or update or delete order conf
cleanExpiredCQ Clean expired ConsumeQueue on broker.
deleteExpiredCommitLog Delete expired CommitLog files
cleanUnusedTopic Clean unused topic on broker.
startMonitoring Start Monitoring
statsAll Topic and Consumer tps stats
allocateMQ Allocate MQ
checkMsgSendRT check message send response time
clusterRT List All clusters Message Send RT
getNamesrvConfig Get configs of name server.
updateNamesrvConfig Update configs of name server.
getBrokerConfig Get broker config by cluster or special broker!
getConsumerConfig Get consumer config by subscription group name!
queryCq Query cq command.
sendMessage Send a message
consumeMessage Consume message
updateAclConfig Update acl config yaml file in broker
deleteAclConfig Delete Acl Config Account in broker
clusterAclConfigVersion List all of acl config version information in cluster
updateGlobalWhiteAddr Update global white address for acl Config File in broker
getAclConfig List all of acl config information in cluster
exportMetadata export metadata
exportConfigs export configs
exportMetrics export metrics

See ‘mqadmin help ’ for more information on a specific command.

The following are mqadminvarious parameters and their meanings about the commands in RocketMQ. RocketMQ is a distributed messaging middleware open sourced by Alibaba. mqadminIt is a command-line tool provided by RocketMQ, which can be used to manage and operate RocketMQ clusters. The following are explanations of some commonly used commands:

  1. updateTopic: Update or create a topic.
  2. deleteTopic: Delete topic from broker and NameServer.
  3. updateSubGroup: Update or create a subscription group.
  4. deleteSubGroup: Delete subscription group from broker.
  5. updateBrokerConfig: Update broker configuration.
  6. updateTopicPerm: Update theme permissions.
  7. topicRoute: Check topic routing information.
  8. topicStatus: Check topic status information.
  9. topicClusterList: Get the topic's cluster information.
  10. brokerStatus: Get broker runtime status data.
  11. queryMsgById: Query messages by ID.
  12. queryMsgByKey: Query messages based on Key.
  13. queryMsgByUniqueKey: Query messages based on the unique key.
  14. queryMsgByOffset: Query messages based on offset.
  15. queryMsgTraceById: Query message tracking based on ID.
  16. printMsg: Print message details.
  17. printMsgByQueue: Print message details according to the queue.
  18. sendMsgStatus: Send message to broker.
  19. brokerConsumeStats: Get broker consumption status data.
  20. producerConnection: Query the socket connection and client version of the producer.
  21. consumerConnection: Query the consumer's socket connection, client version and subscription.
  22. consumerProgress: Query the progress and speed of the consumer.
  23. consumerStatus: Query the internal data structure of the consumer.
  24. cloneGroupOffset: Clone offset from other group.
  25. producer: Query the producer's instance, connection, status, etc.
  26. clusterList: List all clusters.
  27. topicList: Get a list of all topics from the name server.
  28. updateKvConfig: Create or update KV configuration.
  29. deleteKvConfig: Delete KV configuration.
  30. wipeWritePerm: Clear -nthe write permission of brokers in all name servers defined in the parameter.
  31. addWritePerm: -nAdd broker's write permission to all name servers defined in the parameter.
  32. resetOffsetByTime: Reset consumer offset by timestamp (no client restart required).
  33. skipAccumulatedMessage: Skip all currently accumulated (unconsumed) messages.
  34. updateOrderConf: Create, update or delete order conf.
  35. cleanExpiredCQ: Clean up expired ConsumeQueue on the broker.
  36. deleteExpiredCommitLog: Delete expired CommitLog files.
  37. cleanUnusedTopic: Clean up unused topics on the broker.
  38. startMonitoring: Start monitoring.
  39. statsAll: TPS statistics for topics and consumers.
  40. allocateMQ: Allocate a message queue.
  41. checkMsgSendRT: Check message sending response time.
  42. clusterRT: List message sending response times for all clusters.
  43. getNamesrvConfig: Get name server configuration.
  44. updateNamesrvConfig: Update name server configuration.
  45. getBrokerConfig: Get broker configuration according to cluster or specific broker.
  46. getConsumerConfig: Get consumer configuration by subscription group name!
  47. queryCq: Query the cq command.
  48. sendMessage: Send a message.
  49. consumeMessage: Consume messages.
  50. updateAclConfig: Update the acl configuration yaml file in the broker.
  51. deleteAclConfig: Delete the Acl configuration account in the broker.
  52. clusterAclConfigVersion: List all acl configuration version information in the cluster.
  53. updateGlobalWhiteAddr: Update the global whitelist address in the broker for use in the acl configuration file.
  54. getAclConfig: List all acl configuration information in the cluster.
  55. exportMetadata: Export metadata.
  56. exportConfigs: Export configuration.
  57. exportMetrics: Export metrics.

If you need more information about a particular command, you can use 'mqadmin help <command>'the command to get it. For example, if you want to know updateTopicmore about a command, you can run it 'mqadmin help updateTopic'.


insert image description here
This is mqadmin updateTopicthe help information for the command, which is used to update or create a RocketMQ topic. Here are the meanings of the parameters:

  • -b,--brokerAddr <arg>: Create the broker address of the topic.
  • -c,--clusterName <arg>: The name of the cluster where the topic was created.
  • -h,--help: Print help information.
  • -n,--namesrvAddr <arg>: Name server address list, for example: '192.168.0.1:9876;192.168.0.2:9876'.
  • -o,--order <arg>: Set the order of topics (true|false).
  • -p,--perm <arg>: Set the permission of the topic (2|4|6), where 2 represents the write permission, 4 represents the read permission, and 6 represents the read and write permission.
  • -r,--readQueueNums <arg>: Set the number of read queues.
  • -s,--hasUnitSub <arg>: Whether there is a unit subscription (true|false).
  • -t,--topic <arg>: Theme name.
  • -u,--unit <arg>: Whether it is a unit theme (true|false).
  • -w,--writeQueueNums <arg>: Set the number of write queues.

In general, the main function of this command is to allow you to create or update topics in RocketMQ, and adjust the characteristics and performance of the topics by adjusting various parameters.


insert image description here
mqadmin topicStatusis a command-line tool for checking status information on a specified topic. Here is a detailed description of each parameter:

  • -h,--help: Print help information.
  • -n,--namesrvAddr <arg>: Name server address list, for example: '192.168.0.1:9876;192.168.0.2:9876'.
  • -t,--topic <arg>: Topic name, that is, the topic you want to query status.

For example, if you want to query the status of the topic named "testTopic", you can run the following command:

mqadmin topicStatus -n '192.168.0.1:9876' -t 'testTopic'

This will return '192.168.0.1:9876'status information for the "testTopic" topic on this name server.

mqadmin topicStatusThe command will return the status information of the specified topic, including but not limited to the following data:

  • The topic's queue distribution.
  • The accumulation of messages for each queue.
  • Information about producers and consumers, such as: consumption progress, whether there is a consumption delay, etc.

The specific returned content may vary depending on the RocketMQ version and specific configuration. If you want to get the specific return content, you need to execute this command in the specific RocketMQ environment.

Note that the actual returned information may be complex and may require some knowledge of RocketMQ to interpret correctly. If you have trouble interpreting the returned information, I recommend consulting the official RocketMQ documentation or seeking help from the community.


In RocketMQ, mqadminthe command line tool provides the function of obtaining the amount of message accumulation. You can use consumerProgressthe command to get the amount of message accumulation. The following are the specific commands:

mqadmin consumerProgress -n {
    
    namesrvAddr} -g {
    
    consumerGroup}

In this command:

  • {namesrvAddr}is your NameServer address in the format {hostname}:{port}.
  • {consumerGroup}is the name of the consumer group you want to query.

This command will return the consumption progress of the consumer group you specify, including the queue currently consumed by the consumer group, the current consumption offset of the consumer group, and the latest offset of the queue. The message accumulation amount can be obtained by subtracting the consumption offset from the latest offset.

Note that you need to mqadminset ROCKETMQ_HOMEan environment variable on the machine where you run the command, and make sure this environment variable points to your RocketMQ installation directory. At the same time, you need to $ROCKETMQ_HOME/binadd to your PATHenvironment variables so that the system can find mqadminthe command.


RocketMQ's mqadmintools do not directly provide the function of obtaining message processing delay time. Message processing latency usually refers to the time from when a message is sent to when it is successfully consumed. Since this time depends on many factors, including network delay, consumer processing speed, etc., RocketMQ does not provide an interface to directly obtain this time.

However, you can use mqadminthe tool's statsAllcommands to obtain some statistics related to message processing delays, including the TPS (transactions per second) of message sending and consumption, the delay of message sending and consumption, and so on. The following are the specific commands:

mqadmin statsAll -n {
    
    namesrvAddr}

In this command, {namesrvAddr}is your NameServer address in the format {hostname}:{port}.

This command will return the statistics of Broker, Topic and Consumer Group. From this information, you can obtain the TPS of message sending and consumption, as well as the average delay of message sending and consumption. Note that the latency returned by this command is the latency from message sending to message storage, not message processing.

To get the latency of message processing, you may need to record the time of message sending and consumption in your application yourself, and then calculate the latency of message processing. For example, you can add a timestamp field to the message to record the sending time of the message, and then get the current time when consuming the message and subtract the sending time of the message to get the message processing delay.

おすすめ

転載: blog.csdn.net/u011197085/article/details/131546831
おすすめ