内容有点多,左侧有菜单
进入RocketMQ的bin目录:${PACKAGE}/bin,使用命令bash mqadmin,可以看到以下帮助菜单:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# sh 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
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.
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
resetOffsetByTime Reset consumer offset by timestamp(without client restart).
updateOrderConf Create or update or delete order conf
cleanExpiredCQ Clean expired ConsumeQueue on broker.
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!
queryCq Query cq command.
sendMessage Send a message
consumeMessage Consume message
updateAclConfig Update acl config yaml file in broker
deleteAccessConfig 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
getAccessConfigSubCommand List all of acl config information in cluster
See 'mqadmin help ' for more information on a specific command.
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
其中列出了最常用的命令,并附有简短说明。要获取每个命令的详细手册,使用命令**:bash mqadmin help 。例如,命令bash mqadmin help clusterList**将显示以下帮助文本:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# bash mqadmin help clusterList
usage: mqadmin clusterList [-h] [-i ] [-m] [-n ]
-h,--help Print help
-i,--interval specify intervals numbers, it is in seconds
-m,--moreStats Print more stats
-n,--namesrvAddr Name server address list, eg: 192.168.0.1:9876;192.168.0.2:9876
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:修改或创建一个Topic
命令:mqadmin updateTopic -b | -c [-h] [-n ] [-o ] [-p ] [-r ] [-s ] -t [-u ] [-w ]
参数 | 含义 | 备注 |
---|---|---|
-b,--brokerAddr | broker 地址,表示topic 建在该broker | 如果-c为空,则必填 |
-c,--clusterName | cluster 名称,表示topic 建在该集群 | 如果-b为空,则必填 |
-h,--help | 打印help信息 | |
-n,--namesrvAddr | name server地址列表 | 以分号分割,例如:192.168.0.1:9876;192.168.0.2:9876 |
-o,--order | 设置topic是否为有序的 | 取值:true、false(默认) |
-p,--perm | 设置topic的权限 | 取值:2、4、6;含义:2-W、4-R、6-RW(默认) |
-r,--readQueueNums | 设置可读队列数 | 默认为8 |
-s,--hasUnitSub | 设置是否有unit sub | 取值:true、false |
-t,--topic | 设置topic名称 | 名称只能使用字符 ^[a-zA-Z0-9_-]+$ |
-u,--unit | 设置是否为unit topic | 取值:true、false |
-w,--writeQueueNums | 设置可写队列数 | 默认为8 |
注意:
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin updateTopic -c xdf-test1 -t zhurunhua -n 172.24.30.192:9876
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
create topic to 172.24.30.194:10911 success.
create topic to 172.24.30.193:10911 success.
create topic to 172.24.30.192:10911 success.
TopicConfig [topicName=zhurunhua, readQueueNums=8, writeQueueNums=8, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false]
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:从broker和nameserver删除topic
命令:mqadmin deleteTopic -c [-h] [-n ] -t
参数 | 含义 | 备注 |
---|---|---|
-c,–clusterName | 指定cluster名称 | |
-h,–help | 打印help信息 | |
-n,–namesrvAddr | name server地址列表 | 以分号分割,例如:192.168.0.1:9876;192.168.0.2:9876 |
-t,–topic | 设置topic名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin deleteTopic -n 172.24.30.192:9876 -t zhurunhua -c xdf-test1
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
delete topic [zhurunhua] from cluster [xdf-test1] success.
delete topic [zhurunhua] from NameServer success.
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:从nameserver列出所有topic
命令:mqadmin topicList [-c] [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-c,–clusterModel | 指定cluster模式 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin topicList -n 172.24.30.192:9876
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
%DLQ%xxoo
%RETRY%dfub-order
BenchmarkTest
testschedule
...
...
作用:更新topic权限
命令:mqadmin updateTopicPerm [-b ] [-c ] [-h] [-n ] -p -t
参数 | 含义 | 备注 |
---|---|---|
-b,–brokerAddr | 设置更新哪个broker | |
-c,–clusterName | 设置更新哪个cluster | |
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-p,–perm | 设置topic的权限 | 取值:2、4、6;含义:2-W、4-R、6-RW |
-t,–topic | 设置修改的topic名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin updateTopicPerm -n 172.24.30.192:9876 -b 172.24.30.192:10911 -t zhurunhua -p 4
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
update topic perm from 6 to 4 in 172.24.30.192:10911 success.
TopicConfig [topicName=zhurunhua, readQueueNums=8, writeQueueNums=8, perm=R--, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false].
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
注意:需要同时指定nameserver和brokerAddr
作用:检查topic路由信息
命令:mqadmin topicRoute [-h] [-n ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-t,–topic | topic名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin topicRoute -n 172.24.30.192:9876 -t zhurunhua
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
{
"brokerDatas":[
{
"brokerAddrs":{0:"172.24.30.193:10911",1:"172.24.30.192:11911"
},
"brokerName":"broker-b",
"cluster":"xdf-test1"
},
{
"brokerAddrs":{0:"172.24.30.194:10911",1:"172.24.30.193:11911"
},
"brokerName":"broker-c",
"cluster":"xdf-test1"
},
{
"brokerAddrs":{0:"172.24.30.192:10911",1:"172.24.30.194:11911"
},
"brokerName":"broker-a",
"cluster":"xdf-test1"
}
],
"filterServerTable":{},
"queueDatas":[
{
"brokerName":"broker-c",
"perm":6,
"readQueueNums":8,
"topicSynFlag":0,
"writeQueueNums":8
},
{
"brokerName":"broker-b",
"perm":6,
"readQueueNums":8,
"topicSynFlag":0,
"writeQueueNums":8
},
{
"brokerName":"broker-a",
"perm":4,
"readQueueNums":8,
"topicSynFlag":0,
"writeQueueNums":8
}
]
}
作用:检查topic的状态信息
命令:mqadmin topicStatus [-h] [-n ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-t,–topic | topic名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin topicStatus -n 172.24.30.192:9876 -t zhurunhua
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
#Broker Name #QID #Min Offset #Max Offset #Last Updated
broker-a 0 0 0
broker-a 1 0 0
broker-a 2 0 0
broker-a 3 0 0
broker-a 4 0 0
broker-a 5 0 0
broker-a 6 0 0
broker-a 7 0 0
broker-b 0 0 0
broker-b 1 0 0
broker-b 2 0 0
broker-b 3 0 0
broker-b 4 0 0
broker-b 5 0 0
broker-b 6 0 0
broker-b 7 0 0
broker-c 0 0 0
broker-c 1 0 0
broker-c 2 0 0
broker-c 3 0 0
broker-c 4 0 0
broker-c 5 0 0
broker-c 6 0 0
broker-c 7 0 0
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:获取topic的集群信息
命令:mqadmin topicClusterList [-h] [-n ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-t,–topic | topic名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin topicClusterList -n 172.24.30.192:9876 -t zhurunhua
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
xdf-test1
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:清理未使用的topic
命令:mqadmin cleanUnusedTopic [-b ] [-c ] [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerAddr | broker地址 | |
-c,–cluster | 集群名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin cleanUnusedTopic -n 172.24.30.192:9876 -b 172.24.30.192:10911;172.24.30.193:10911;172.24.30.194:10911
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
success
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
注意:需同时指定nameserver和broker地址,若只指定了nameserver,会报错:wait response on the channel <172.24.30.192:9876> timeout, 4904(ms)
作用:发送消息
命令:mqadmin sendMessage [-b ] [-c ] [-h] [-i ] [-k ] [-n ] -p -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–broker | 设置发送消息的目标broker | |
-c,–tags | Message tags | |
-i,–qid | 设置目标queue | |
-k,–key | 消息key | |
-p,–body | 消息体 | UTF-8编码,字符串 |
-t,–topic | topic名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin sendMessage -n 172.24.30.192:9876 -t zhurunhua -k test-key -p test-body
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
#Broker Name #QID #Send Result #MsgId
broker-b 6 SEND_OK AC110001DD437EA987AC6F4D48590000
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
注意:
作用:发送消息到broker
命令:mqadmin sendMsgStatus -b [-c ] [-h] [-n ] [-s ]
注意:并不是真正发送消息,只是检测消息的发送状态(sendStatus、rt)
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerName | broker名称 | |
-c,–count | 发送消息数量 | 默认:50 |
-s,–messageSize | 消息大小 | 默认:128 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin sendMsgStatus -b broker-a -n 172.24.30.192:9876 -c 3 -s 64
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
rt:1ms, SendResult=SendResult [sendStatus=SEND_OK, msgId=AC110001F3237EA987AC6F72C5140001, offsetMsgId=AC181EC000002A9F000000014136B4B6, messageQueue=MessageQueue [topic=broker-a, brokerName=broker-a, queueId=0], queueOffset=58]rt:1ms, SendResult=SendResult [sendStatus=SEND_OK, msgId=AC110001F3237EA987AC6F72C5160002, offsetMsgId=AC181EC000002A9F000000014136B597, messageQueue=MessageQueue [topic=broker-a, brokerName=broker-a, queueId=0], queueOffset=59]rt:5ms, SendResult=SendResult [sendStatus=SEND_OK, msgId=AC110001F3237EA987AC6F72C5170003, offsetMsgId=AC181EC000002A9F000000014136B678, messageQueue=MessageQueue [topic=broker-a, brokerName=broker-a, queueId=0], queueOffset=60]
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:根据key查询消息
命令:mqadmin queryMsgByKey [-h] -k [-n ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-t,–topic | topic名称 | |
-k,–msgKey | 消息key |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin queryMsgByKey -n 172.24.30.192:9876 -k test-key1 -t zhurunhua
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
#Message ID #QID #Offset
AC110001E0BD7EA987AC6F5319D10000 5 0
AC110001E1347EA987AC6F5353DD0000 7 0
AC110001E1727EA987AC6F537C7E0000 7 1
AC110001E2697EA987AC6F55DD160000 2 0
AC110001E5CC7EA987AC6F5AD1B30000 1 0
AC110001DE177EA987AC6F4F1BE30000 0 0
AC110001DE4D7EA987AC6F4F5A730000 0 1
AC110001DE817EA987AC6F4FA88E0000 3 0
AC110001DF467EA987AC6F509C6C0000 3 1
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:根据消息id查询消息
命令: [-d ] [-g ] [-h] -i [-n ] [-s ] [-u ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-d,–clientId | 消费者客户端id | |
-g,–consumerGroup | 订阅组名称 | |
-i,–msgId | 消息id | |
-s,–sendMessage | resend message | |
-u,–unitName | unit name |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin queryMsgById -i AC181EC100002A9F000000018A727660 -n 172.24.30.192:9876
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
OffsetID: AC181EC100002A9F000000018A727660
Topic: zhurunhua
Tags: [测试message]
Keys: [test-key]
Queue ID: 2
Queue Offset: 0
CommitLog Offset: 6617724512
Reconsume Times: 0
Born Timestamp: 2020-09-22 15:08:31,339
Store Timestamp: 2020-09-22 15:08:31,345
Born Host: 172.24.30.192:25687
Store Host: 172.24.30.193:10911
System Flag: 0
Properties: {KEYS=test-key, UNIQ_KEY=AC110001EBBC7EA987AC6F6552EB0000, CLUSTER=xdf-test1, WAIT=true, TAGS=测试message}
Message Body Path: /tmp/rocketmq/msgbodys/AC110001EBBC7EA987AC6F6552EB0000
作用:根据唯一key查询消息
命令:mqadmin queryMsgByUniqueKey [-d ] [-g ] [-h] -i [-n ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-d,–clientId | 消费者客户端id | |
-g,–consumerGroup | 订阅组名称 | |
-i,–msgId | 消息id | |
-t,–topic | topic名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin queryMsgByUniqueKey -i AC110001E5CC7EA987AC6F5AD1B30000 -n 172.24.30.192:9876 -t zhurunhua
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
Topic: zhurunhua
Tags: [测试message]
Keys: [test-key1]
Queue ID: 1
Queue Offset: 0
CommitLog Offset: 5865661490
Reconsume Times: 0
Born Timestamp: 2020-09-22 14:57:02,899
Store Timestamp: 2020-09-22 14:57:02,904
Born Host: 172.24.30.192:56596
Store Host: 172.24.30.194:10911
System Flag: 0
Properties: {KEYS=test-key1, UNIQ_KEY=AC110001E5CC7EA987AC6F5AD1B30000, CLUSTER=xdf-test1, WAIT=true, TAGS=测试message}
Message Body Path: /tmp/rocketmq/msgbodys/AC110001E5CC7EA987AC6F5AD1B30000
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:根据offset查询消息
命令:mqadmin queryMsgByOffset -b [-h] -i [-n ] -o -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-t,–topic | topic名称 | |
-b,–brokerName | broker名称 | 这里需要注意填写的是broker 的名称,不是broker 的地址,broker名称可以在clusterList 查到 |
-i,–queueId | 队列id | 默认是8个,queue id从0到7 |
-o,–offset | offset 值 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin queryMsgByOffset -n 172.24.30.192:9876 -i 6 -o 0 -t zhurunhua -b broker-b
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
OffsetID: AC181EC100002A9F000000018A6399BE
Topic: zhurunhua
Tags: [null]
Keys: [test-key]
Queue ID: 6
Queue Offset: 0
CommitLog Offset: 6616750526
Reconsume Times: 0
Born Timestamp: 2020-09-22 14:42:15,770
Store Timestamp: 2020-09-22 14:42:15,775
Born Host: 172.24.30.192:26838
Store Host: 172.24.30.193:10911
System Flag: 0
Properties: {MIN_OFFSET=0, MAX_OFFSET=1, KEYS=test-key, UNIQ_KEY=AC110001DD437EA987AC6F4D48590000, CLUSTER=xdf-test1, WAIT=true}
Message Body Path: /tmp/rocketmq/msgbodys/AC110001DD437EA987AC6F4D48590000
作用:打印消息详情
命令:mqadmin printMsg [-b ] [-c ] [-d ] [-e ] [-h] [-n ] [-s ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-t,–topic | topic名称 | |
-b,–beginTimestamp | 开始时间戳 | 时间戳 或 yyyy-MM-dd#HH:mm:ss:SSS格式的时间 |
-c,–charsetName | 字符编码名称 | 例如:UTF-8,GBK |
-d,–printBody | 是否打印消息体 | true 、false |
-e,–endTimestamp | 结束时间戳 | |
-s,–subExpression | Subscribe Expression |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin printMsg -t zhurunhua -n 172.24.30.192:9876 -e 1600757317080
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
minOffset=0, maxOffset=0, MessageQueue [topic=zhurunhua, brokerName=broker-c, queueId=7]minOffset=0, maxOffset=0, MessageQueue [topic=zhurunhua, brokerName=broker-b, queueId=6]minOffset=0, maxOffset=0, MessageQueue [topic=zhurunhua, brokerName=broker-a, queueId=5]minOffset=0, maxOffset=0, MessageQueue [topic=zhurunhua, brokerName=broker-b, queueId=7]minOffset=0, maxOffset=0, MessageQueue [topic=zhurunhua, brokerName=broker-a, queueId=6]minOffset=0, maxOffset=0, MessageQueue [topic=zhurunhua, brokerName=broker-a, queueId=7]minOffset=0, maxOffset=0, MessageQueue [topic=zhurunhua, brokerName=broker-c, queueId=0]minOffset=0, maxOffset=0, MessageQueue [topic=zhurunhua, brokerName=broker-c, queueId=1]minOffset=0, maxOffset=1, MessageQueue [topic=zhurunhua, brokerName=broker-b, queueId=0]MSGID: AC110001DE177EA987AC6F4F1BE30000 MessageExt [brokerName=broker-b, queueId=0, storeSize=195, queueOffset=0, sysFlag=0, bornTimestamp=1600757055459, bornHost=/172.24.30.192:34188, storeTimestamp=1600757055464, storeHost=/172.24.30.193:10911, msgId=AC181EC100002A9F000000018A64C05D, commitLogOffset=6616825949, bodyCRC=1801232349, reconsumeTimes=0, preparedTransactionOffset=0, toString()=Message{topic='zhurunhua', flag=0, properties={MIN_OFFSET=0, MAX_OFFSET=2, KEYS=test-key1, UNIQ_KEY=AC110001DE177EA987AC6F4F1BE30000, CLUSTER=xdf-test1, WAIT=true}, body=[116, 101, 115, 116, 45, 98, 111, 100, 121, 49], transactionId='null'}] BODY: test-body1
MSGID: AC110001DE4D7EA987AC6F4F5A730000 MessageExt [brokerName=broker-b, queueId=0, storeSize=195, queueOffset=1, sysFlag=0, bornTimestamp=1600757071475, bornHost=/172.24.30.192:39631, storeTimestamp=1600757071480, storeHost=/172.24.30.193:10911, msgId=AC181EC100002A9F000000018A6543C4, commitLogOffset=6616859588, bodyCRC=1801232349, reconsumeTimes=0, preparedTransactionOffset=0, toString()=Message{topic='zhurunhua', flag=0, properties={MIN_OFFSET=0, MAX_OFFSET=2, KEYS=test-key1, UNIQ_KEY=AC110001DE4D7EA987AC6F4F5A730000, CLUSTER=xdf-test1, WAIT=true}, body=[116, 101, 115, 116, 45, 98, 111, 100, 121, 49], transactionId='null'}]
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:通过queue id查询消息详情
命令: -a [-b ] [-c ] [-d ] [-e ] [-f ] [-h] -i [-n ] [-p ] [-s ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-a,–brokerName | broker名称 | |
-b,–beginTimestamp | 开始时间戳 | 时间戳 或 yyyy-MM-dd#HH:mm:ss:SSS |
-e,–endTimestamp | 结束时间戳 | |
-c,–charsetName | 字符编码名称 | 例如:UTF-8,GBK |
-d,–printBody | print body | |
-f,–calculate | calculate by tag | true|false(default) |
-i,–queueId | 队列id | |
-p,–print msg | 是否打印消息 | true|false(default) |
-s,–subExpression | Subscribe Expression | |
-t,–topic | topic名称 |
示例:
./mqadmin printMsgByQueue -n 172.24.30.192:9876 -a broker-b -t zhurunhua -i 0 -c UTF-8
作用:消费消息
命令:mqadmin consumeMessage [-b ] [-c ] [-e ] [-g ] [-h] [-i ] [-n ] [-o ] [-s ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerName | broker名称 | |
-c,–MessageNumber | 消费消息数量 | |
-s,–beginTimestamp | 开始时间 | currentTimeMillis或yyyy-MM-dd#HH:mm:ss:SSS格式表示的时间 |
-e,–endTimestamp | 结束时间 | |
-g,–consumerGroup | 消费者组名称 | |
-i,–queueId | queue id | |
-o,–offset | queue offset | |
-t,–topic | topic名称 |
示例:
./mqadmin consumeMessage -n 172.24.30.192:9876 -t zhurunhua -b broker-a -c 3 -g zhurunhua
作用:修改或创建订阅组
命令:mqadmin updateSubGroup [-a ] [-b ] [-c ] [-d ] -g [-h] [-i ] [-m ] [-n ] [-q ] [-r ] [-s ] [-w ]
参数 | 含义 | 备注 |
---|---|---|
-a,–notifyConsumerIdsChanged | notify consumerId changed | true(默认)|false |
-b,–brokerAddr | broker 地址,表示订阅组建在该broker | |
-c,–clusterName | cluster名称,表示订阅组建在该集群 | |
-d,–consumeBroadcastEnable | 是否允许广播方式消费 | true|false(默认) |
-g,–groupName | 设置订阅组名称 | |
-h,–help | 打印help信息 | |
-i,–brokerId | 设置从哪个broker开始消费 | 默认0 |
-m,–consumeFromMinEnable | 是否容许从队列的最小位置开始消费 | true|false(默认) |
-n,–namesrvAddr | nameserver服务地址列表 | |
-q,–retryQueueNums | 消费失败的消息放到一个重试队列,每个订阅组配置几个重试队列 | 默认1 |
-r,–retryMaxTimes | 重试消费最大次数 | 超过则投递到死信队列,不再投递,并报警;默认16 |
-s,–consumeEnable | 消费功能是否开启 | true(默认)|false |
-w,–whichBrokerWhenConsumeSlowly | 发现消息堆积后,将Consumer的消费请求重定向到另外一台Slave机器 | 配置broker id,默认1 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin updateSubGroup -n 172.24.30.192:9876 -d true -g zhurunhua-consume-group -m true -q 8 -r 3 -s true -w 1 -c xdf-test1
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
create subscription group to 172.24.30.194:10911 success.
create subscription group to 172.24.30.193:10911 success.
create subscription group to 172.24.30.192:10911 success.
SubscriptionGroupConfig [groupName=zhurunhua-consume-group, consumeEnable=true, consumeFromMinEnable=true, consumeBroadcastEnable=true, retryQueueNums=8, retryMaxTimes=3, brokerId=0, whichBrokerWhenConsumeSlowly=1, notifyConsumerIdsChangedEnable=true][root@XXGL-T-TJSYZ-REDIS-01 bin]#
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
注意:必须指定clusterName
作用:删除订阅组
命令:mqadmin deleteSubGroup [-b ] [-c ] -g [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-b,–brokerAddr | broker地址,表示在该broker删除订阅组 | |
-c,–clusterName | cluster 名称,表示在该集群删除订阅组 | |
-g,–groupName | 指定删除的订阅组名称 | |
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver 服务地址列表 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin deleteSubGroup -n 172.24.30.192:9876 -g zhurunhua-consume-group -c xdf-test1
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
delete subscription group [zhurunhua-consume-group] from broker [172.24.30.194:10911] in cluster [xdf-test1] success.
delete subscription group [zhurunhua-consume-group] from broker [172.24.30.193:10911] in cluster [xdf-test1] success.
delete subscription group [zhurunhua-consume-group] from broker [172.24.30.192:10911] in cluster [xdf-test1] success.
delete topic [%RETRY%zhurunhua-consume-group] from cluster [xdf-test1] success.
delete topic [%RETRY%zhurunhua-consume-group] from NameServer success.
delete topic [%DLQ%zhurunhua-consume-group] from cluster [xdf-test1] success.
delete topic [%DLQ%zhurunhua-consume-group] from NameServer success.
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
注意:必须指定clusterName
作用:从其他组克隆offset
命令: mqadmin cloneGroupOffset -d [-h] [-n ] [-o ] -s -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-s,–srcGroup | 源消费者组名称 | |
-d,–destGroup | 目标消费者组名称 | |
-o,–offline | the group or the topic is offline | true|false |
-t,–topic | topic名称 |
示例:
./mqadmin cloneGroupOffset -n 172.24.30.192:9876 -s zhurunhua-1 -d zhurunhua-2 -t zhurunhua
作用:获取broker运行时的状态数据
命令: mqadmin brokerStatus [-b ] [-c ] [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerAddr | broker地址 | |
-c,–clusterName | 集群名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin brokerStatus -n 172.24.30.192:9876 -b 172.24.30.192:10911
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
EndTransactionQueueSize : 0
EndTransactionThreadPoolQueueCapacity: 100000
bootTimestamp : 1600660736545
brokerVersion : 355
brokerVersionDesc : V4_7_1
commitLogDirCapacity : Total : 40.0 GiB, Free : 23.9 GiB.
commitLogDiskRatio : 0.40273704594017096
commitLogMaxOffset : 5389336601
commitLogMinOffset : 5368709120
consumeQueueDiskRatio : 0.40273704594017096
dispatchBehindBytes : 0
dispatchMaxBuffer : 0
earliestMessageTimeStamp : 1600310170573
getFoundTps : 0.0 0.033330000333300004 0.046661689419795226
getMessageEntireTimeMax : 8
getMissTps : 17.998200179982 27.1639502716395 26.75381292662116
getTotalTps : 17.998200179982 27.1972802719728 26.800474616040955
getTransferedTps : 0.0 0.033330000333300004 0.046661689419795226
msgGetTotalTodayMorning : 2185
msgGetTotalTodayNow : 4046
msgGetTotalYesterdayMorning : 0
msgPutTotalTodayMorning : 2918
msgPutTotalTodayNow : 5357
msgPutTotalYesterdayMorning : 0
pageCacheLockTimeMills : 0
pullThreadPoolQueueCapacity : 100000
pullThreadPoolQueueHeadWaitTimeMills: 0
pullThreadPoolQueueSize : 0
putMessageAverageSize : 428.9402650737353
putMessageDistributeTime : [<=0ms]:3 [0~10ms]:1 [10~50ms]:0 [50~100ms]:0 [100~200ms]:0 [200~500ms]:0 [500ms~1s]:0 [1~2s]:0 [2~3s]:0 [3~4s]:0 [4~5s]:0 [5~10s]:0 [10s~]:0
putMessageEntireTimeMax : 10
putMessageSizeTotal : 2297833
putMessageTimesTotal : 5357
putTps : 0.0 0.06666000066660001 0.09498986774744028
queryThreadPoolQueueCapacity : 20000
queryThreadPoolQueueHeadWaitTimeMills: 0
queryThreadPoolQueueSize : 0
remainHowManyDataToFlush : 0 B
remainTransientStoreBufferNumbs : 2147483647
runtime : [ 1 days, 5 hours, 32 minutes, 46 seconds ]
...
...
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
注意:使用-c会查处所有broker状态信息,包含所有主、从,使用-b只能指定一个broker查询
作用:获取消耗统计数据
命令:mqadmin brokerConsumeStats -b [-h] [-l ] [-n ] [-o ] [-t ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerAddr | broker地址 | |
-l,–level | threshold of print diff | |
-o,–order | order topic | |
-t,–timeoutMillis | 请求超时时间 | 单位:毫秒 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin brokerConsumeStats -b 172.24.30.192:10911 -n 172.24.30.192:9876
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
#Topic #Group #Broker Name #QID #Broker Offset #Consumer Offset #Diff #LastTime
%RETRY%dfub-roster-data dfub-roster-data broker-a 0 13612 13612 0 2020-09-22 17:37:20
dfub-jiaowu-roster-push-data-t dfub-roster-data broker-a 0 197 197 0 2020-09-22 15:44:00
dfub-jiaowu-roster-push-data-t dfub-roster-data broker-a 1 203 203 0 2020-09-22 16:21:09
dfub-jiaowu-roster-push-data-t dfub-roster-data broker-a 2 202 202 0 2020-09-22 11:52:00
dfub-jiaowu-roster-push-data-t dfub-roster-data broker-a 3 195 195 0 2020-09-22 15:16:21
dfub-jiaowu-roster-push-data-t dfub-roster-data broker-a 4 196 196 0 2020-09-22 16:07:32
dfub-jiaowu-roster-push-data-t dfub-roster-data broker-a 5 201 201 0 2020-09-22 17:25:41
dfub-jiaowu-roster-push-data-t dfub-roster-data broker-a 6 203 203 0 2020-09-22 16:24:30
dfub-jiaowu-roster-push-data-t dfub-roster-data broker-a 7 207 207 0 2020-09-22 17:33:16
......
作用:查询Producer 的网络连接,该命令只打印当前与cluster 连接的producer 网络连接信息
命令:mqadmin producerConnection -g [-h] [-n ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-g,–producerGroup | 生产者所属组名 | |
-t,–topic | topic名称 |
示例:
作用:查询Consumer的网络连接,该命令只打印当前与cluster连接的consumer网络连接信息
命令:mqadmin consumerConnection -g [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-g,–consumerGroup | 消费者所属组名 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin consumerConnection -n 172.24.30.192:9876 -g dfub-lesson
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
001 172.24.202.77@org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_1 172.24.202.77:29200 JAVA V4_5_1
002 10.155.86.170@org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_1 10.155.86.170:60246 JAVA V4_5_1
003 172.24.202.79@org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_1 172.24.202.79:28141 JAVA V4_5_1
004 10.155.87.190@org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_1 10.155.87.190:62559 JAVA V4_5_1
Below is subscription:001 Topic: ${rocketmq.producer.customized-lesson-delay-message-topic} SubExpression: *
002 Topic: %RETRY%dfub-lesson SubExpression: *
ConsumeType: CONSUME_PASSIVELY
MessageModel: CLUSTERING
ConsumeFromWhere: CONSUME_FROM_LAST_OFFSET
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:查看订阅组消费状态
命令:mqadmin consumerProgress [-g ] [-h] [-n ] [-s ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-g,–groupName | 消费者所属组名 | |
-s,–showClientIP | 显示每个queue的客户端IP | true|false(默认) |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin consumerProgress -n 172.24.30.192:9876 -g dfub-lvb-student-transfer -s true
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
#Topic #Broker Name #QID #Broker Offset #Consumer Offset #Client IP #Diff #LastTime
%RETRY%dfub-lvb-student-transfer broker-a 0 16 16 172.24.202.77 0 N/A
%RETRY%dfub-lvb-student-transfer broker-b 0 0 0 172.24.202.77 0 N/A
%RETRY%dfub-lvb-student-transfer broker-c 0 96 96 172.24.202.77 0 N/A
dfub-banke-transfer-lesson-data- broker-a 0 1 1 172.24.202.77 0 2020-09-22 15:55:15
dfub-banke-transfer-lesson-data- broker-a 1 2 2 172.24.202.77 0 N/A
dfub-banke-transfer-lesson-data- broker-a 2 0 0 172.24.202.77 0 N/A
dfub-banke-transfer-lesson-data- broker-a 3 1 1 172.24.202.77 0 N/A
dfub-banke-transfer-lesson-data- broker-a 4 3 3 172.24.202.77 0 N/A
dfub-banke-transfer-lesson-data- broker-a 5 3 3 172.24.202.77 0 2020-09-18 16:02:10
dfub-banke-transfer-lesson-data- broker-a 6 7 7 172.24.202.77 0 2020-09-21 10:38:30
dfub-banke-transfer-lesson-data- broker-a 7 1 1 172.24.202.77 0 2020-09-17 21:27:31
作用:查看消费者的内部数据结构
命令:mqadmin consumerStatus -g [-h] [-i ] [-n ] [-s]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-i,–clientId | 消费者客户端id | |
-g,–consumerGroup | 消费者所属组名 | |
-s,–jstack | 在消费者进程中运行jstack命令 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin consumerStatus -n 172.24.30.192:9876 -g dfub-lvb-student-transfer -s
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
001 172.24.202.77@org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_10 V4_5_1 1600767940334/172.24.202.77@org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer_10
Same subscription in the same group of consumer
Rebalance OK
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:查看集群信息
命令:mqadmin clusterList [-h] [-i ] [-m] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-i,–interval | 指定间隔数 | 单位:秒 |
-m,–moreStats | 打印更多信息 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin clusterList -n 172.24.30.192:9876 -m -i 5
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
#Cluster Name #Broker Name #InTotalYest #OutTotalYest #InTotalToday #OutTotalToday
xdf-test1 broker-a 2918 2185 2519 1909
xdf-test1 broker-a 3786 0 2519 0
xdf-test1 broker-b 155267 180068 116494 34032
xdf-test1 broker-b 180526 0 116494 0
xdf-test1 broker-c 7443 14816 92479 102952
xdf-test1 broker-c 7463 6598 92479 0
#Cluster Name #Broker Name #InTotalYest #OutTotalYest #InTotalToday #OutTotalToday
xdf-test1 broker-a 2918 2185 2520 1910
xdf-test1 broker-a 3786 0 2520 0
xdf-test1 broker-b 155267 180068 116602 34040
xdf-test1 broker-b 180526 0 116602 0
xdf-test1 broker-c 7443 14816 92587 103070
xdf-test1 broker-c 7463 6598 92587 0
注意:若指定了-i,则会每经过指定秒数刷新一次,不指定则只打印一次
作用:查看topic和consumer的tps信息
命令:mqadmin statsAll [-a] [-h] [-n ] [-t ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-a,–activeTopic | 只打印活跃的topic信息 | |
-t,–topic | 只打印指定的topic |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin statsAll -n 172.24.30.192:9876 -a -t zhurunhua
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
#Topic #Consumer Group #Accumulation #InTPS #OutTPS #InMsg24Hour #OutMsg24Hour
zhurunhua 0 0.00 13 NO_CONSUMER
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:检查消息发送响应时间
命令:mqadmin checkMsgSendRT [-a ] [-h] [-n ] -s -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-a,–amount | 消息数量 | 默认:100 |
-s,–size | 消息大小 | 默认:128 Byte |
-t,–topic | topic名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin checkMsgSendRT -n 172.24.30.192:9876 -a 10 -s 64 -t zhurunhua
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
#Broker Name #QID #Send Result #RT
broker-b 0 true 211
broker-b 1 true 2
broker-b 2 true 7
broker-b 3 true 2
broker-b 4 true 3
broker-b 5 true 3
broker-b 6 true 3
broker-b 7 true 3
broker-c 0 true 6
broker-c 1 true 3
Avg RT: 3.56
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:列出所有cluster消息发送响应时间
命令:mqadmin clusterRT [-a ] [-c ] [-h] [-i ] [-m ] [-n ] [-p ] -s
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-a,–amount | 消息数量 | 默认:100 |
-c,–cluster | 指定cluster名称 | 不指定则打印所有 |
-i,–interval | 打印间隔 | 默认:10秒 |
-m,–machine room | 机器room name | 默认:noname |
-p,–print log | 以日志形式打印 | true|false(默认) |
-s,–size | 消息大小 | 默认:128 Byte |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin clusterRT -n 172.24.30.192:9876 -s 128 -i 3
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
#Cluster Name #Broker Name #RT #successCount #failCount
xdf-test1 broker-b 1.82 50 0
xdf-test1 broker-c 1.53 50 0
xdf-test1 broker-a 1.27 50 0
xdf-test1 broker-b 1.78 50 0
xdf-test1 broker-c 1.49 50 0
xdf-test1 broker-a 0.88 50 0
xdf-test1 broker-b 0.90 50 0
xdf-test1 broker-c 1.08 50 0
xdf-test1 broker-a 0.94 50 0
xdf-test1 broker-b 0.86 50 0
xdf-test1 broker-c 0.92 50 0
xdf-test1 broker-a 0.49 50 0
[root@XXGL-T-TJSYZ-REDIS-01 log]#
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin clusterRT -n 172.24.30.192:9876 -s 128 -p true -i 3
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
2020-09-22 17:56:26|noname|xdf-test1|broker-b|2
2020-09-22 17:56:26|noname|xdf-test1|broker-c|2
2020-09-22 17:56:27|noname|xdf-test1|broker-a|1
2020-09-22 17:56:30|noname|xdf-test1|broker-b|1
2020-09-22 17:56:30|noname|xdf-test1|broker-c|2
2020-09-22 17:56:30|noname|xdf-test1|broker-a|1
2020-09-22 17:56:33|noname|xdf-test1|broker-b|1
2020-09-22 17:56:33|noname|xdf-test1|broker-c|1
2020-09-22 17:56:33|noname|xdf-test1|broker-a|1
作用:查询cq命令
命令: mqadmin queryCq [-b ] [-c ] [-g ] [-h] -i [-n ] -q -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–broker | broker地址 | |
-c,–count | 设置数量 | |
-g,–consumer | 设置消费者组名称 | |
-i,–index | 设置queue开始索引 | |
-q,–queue | 设置queue数量 | |
-t,–topic | topic名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin queryCq -n 172.24.30.192:9876 -i 0 -q 2 -t dfub-banke-card-attend-notify-t
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
Queue data:
max: 1, min: 0
======================================
idx: 0
ConsumeQueueData{physicOffset=6609928052, physicSize=395, tagsCode=0, extendDataJson='null', bitMap='null', eval=false, msg='null'}
======================================
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:清除特定Brokerd的写权限
命令:mqadmin wipeWritePerm -b [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerName | broker name |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin wipeWritePerm -n 172.24.30.192:9876 -b broker-a
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
wipe write perm of broker[broker-a] in name server[172.24.30.192:9876] OK, 187
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:通过时间戳重置消费者offset(不用重启客户端)
命令:mqadmin resetOffsetByTime [-c] [-f ] -g [-h] [-n ] -s -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-c,–cplus | 重置客户端offset | |
-f,–force | 通过时间戳强制回滚 | true、false,默认为true |
-g,–group | 消费者所属组名 | |
-s,–timestamp | 设置时间戳 | 选项:now、currentTimeMillis、yyyy-MM-dd#HH:mm:ss:SSS |
-t,–topic | topic名称 |
示例:
./mqadmin resetOffsetByTime -n 172.24.30.192:9876 -g zhurunhua-1 -s now -t zhurunhua
作用:清理过期的消费者队列
命令:mqadmin cleanExpiredCQ [-b ] [-c ] [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerAddr | broker地址 | |
-c,–cluster | 集群名称 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin cleanExpiredCQ -n 172.24.30.192:9876 -c xdf-test1
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
success
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:开启监控
命令:mqadmin startMonitoring [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 |
示例:
./mqadmin startMonitoring -n 172.24.30.192:9876
作用:分配MQ
命令:mqadmin allocateMQ [-h] -i [-n ] -t
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-i,–ipList | ip列表 | |
-t,–topic | topic名称 |
示例:
作用:获取name server 配置
命令:mqadmin getNamesrvConfig [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin getNamesrvConfig -n 172.24.30.192:9876
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
============172.24.30.192:9876============
serverChannelMaxIdleTimeSeconds = 120
listenPort = 9876
serverCallbackExecutorThreads = 0
serverAsyncSemaphoreValue = 64
serverSocketSndBufSize = 65535
rocketmqHome = /neworiental/rocketmq-nameserver/rocketmq-all-4.7.1-bin-release
clusterTest = false
serverSelectorThreads = 3
useEpollNativeSelector = false
orderMessageEnable = false
serverPooledByteBufAllocatorEnable = true
kvConfigPath = /neworiental/rocketmq-nameserver/namesrv/kvConfig.json
serverWorkerThreads = 8
serverSocketRcvBufSize = 65535
productEnvName = center
serverOnewaySemaphoreValue = 256
configStorePath = /neworiental/rocketmq-nameserver/rocketmq-all-4.7.1-bin-release/conf/nameserver.conf
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
注意:经测试,-n每次只能指定一个nameserver地址
作用:修改name server 配置
命令:mqadmin updateNamesrvConfig [-h] -k [-n ] -v
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-k,–key | config key值 | |
-v,–value | config value值 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin updateNamesrvConfig -n 172.24.30.192:9876 -k serverSelectorThreads -v 5
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
update name server config success![172.24.30.192:9876]
serverSelectorThreads : 5
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
注意:每次只能修改一个nameserver
作用:创建或修改KV配置信息
命令:mqadmin updateKvConfig [-h] -k [-n ] -s -v
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-s,–namespace | namespace值 | |
-k,–key | key值 | |
-v,–value | value值 |
示例:
作用:删除KV配置信息
命令: mqadmin deleteKvConfig [-h] -k [-n ] -s
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-k,–key | key值 | |
-s,–namespace | namespace值 |
示例:
作用:更新broker配置文件
命令:mqadmin updateBrokerConfig [-b ] [-c ] [-h] -k [-n ] -v
参数 | 含义 | 备注 |
---|---|---|
-b,–brokerAddr | broker地址,如果未指定-c,则必填 | |
-c,–clusterName | cluster名称,如果未指定-b,则必填 | |
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-k,–key | 配置的key值 | |
-v,–value | 配置的value值 |
示例:
[root@XXGL-T-TJSYZ-REDIS-01 bin]# ./mqadmin updateBrokerConfig -n 172.24.30.192:9876 -c xdf-test1 -k diskMaxUsedSpaceRatio -v 70
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0).
RocketMQLog:WARN Please initialize the logger system properly.
update broker config success, 172.24.30.194:10911
update broker config success, 172.24.30.193:10911
update broker config success, 172.24.30.192:10911
[root@XXGL-T-TJSYZ-REDIS-01 bin]#
作用:获取broker配置
命令:mqadmin getBrokerConfig [-b ] [-c ] [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerAddr | broker地址,如果未指定-c,则必填 | |
-c,–clusterName | cluster名称,如果未指定-b,则必填 |
示例:
./mqadmin getBrokerConfig -n 172.24.30.192:9876 -c xdf-test1
./mqadmin getBrokerConfig -n 172.24.30.192:9876 -b localhost:10911
由于配置项过多,此处省略
注意:-c会打印出集群内的所有broker配置信息,-b可以打印指定的broker(只能指定一个)
作用:修改ACL配置yaml文件
命令:mqadmin updateAclConfig -a -b | -c [-g ] [-h] [-i ] [-m ] [-n ] [-s ] [-t ] [-u ] [-w ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-a,–accessKey | 在acl配置文件中配置accessKey | |
-b,–brokerAddr | 指定修改acl配置文件的broker地址 | |
-c,–clusterName | 指定修改acl配置文件的cluster名称 | |
-g,–groupPerms | 配置组的权限列表 | 例如: groupD=DENY,groupD=SUB |
-i,–defaultTopicPerm | 设置默认的topic权限 | |
-m,–admin | 设置admin标识 | |
-s,–secretKey | 设置secretKey | |
-t,–topicPerms | 设置topic权限列表 | 例如: topicA=DENY,topicD=SUB |
-u,–defaultGroupPerm | 设置默认的组权限 | |
-w,–whiteRemoteAddress | 设置ip白名单 |
示例:
作用:删除ACL配置
命令:mqadmin deleteAccessConfig -a -b | -c [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-a,–accessKey | 设置accessKey | |
-b,–brokerAddr | 指定broker地址 | |
-c,–clusterName | 指定cluster名称 |
示例:
作用:列出所有ACL配置版本信息
命令:mqadmin clusterAclConfigVersion -b | -c [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerAddr | 指定broker地址 | |
-c,–clusterName | 指定cluster名称 |
示例:
./mqadmin clusterAclConfigVersion -n 172.24.30.192:9876 -b 172.24.30.192:10911
作用:修改acl配置的全局白名单
命令:mqadmin updateGlobalWhiteAddr -b | -c -g [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerAddr | 指定broker地址 | |
-c,–clusterName | 指定cluster名称 | |
-g,–globalWhiteRemoteAddresses | 设置全局白名单列表 | 例如: 10.10.103.*,192.168.0.* |
示例:
作用:列出所有acl配置信息
命令:mqadmin getAccessConfigSubCommand -b | -c [-h] [-n ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-b,–brokerAddr | 指定broker地址 | |
-c,–clusterName | 指定cluster名称 |
示例:
./mqadmin getAccessConfigSubCommand -n 172.24.30.192:9876 -b 172.24.30.192:10911
作用:创建、修改或删除order conf
命令:mqadmin updateOrderConf [-h] -m [-n ] -t [-v ]
参数 | 含义 | 备注 |
---|---|---|
-h,–help | 打印help信息 | |
-n,–namesrvAddr | nameserver服务地址列表 | |
-m,–method | 操作类型 | 例如:put、get、delete |
-t,–topic | topic名称 | |
-v,–orderConf | 设置order conf |
示例:
已提交PR,并被官方合并至master分支