| |
| # 运维管理 |
| --- |
| |
| ### 1 集群搭建 |
| |
| #### 1.1 单Master模式 |
| |
| 这种方式风险较大,一旦Broker重启或者宕机时,会导致整个服务不可用。不建议线上环境使用,可以用于本地测试。 |
| |
| ##### 1)启动 NameServer |
| |
| ```bash |
| ### 首先启动Name Server |
| $ nohup sh mqnamesrv & |
| |
| ### 验证Name Server 是否启动成功 |
| $ tail -f ~/logs/rocketmqlogs/namesrv.log |
| The Name Server boot success... |
| ``` |
| |
| ##### 2)启动 Broker |
| |
| ```bash |
| ### 启动Broker |
| $ nohup sh bin/mqbroker -n localhost:9876 & |
| |
| ### 验证Broker是否启动成功,例如Broker的IP为:192.168.1.2,且名称为broker-a |
| $ tail -f ~/logs/rocketmqlogs/broker.log |
| The broker[broker-a, 192.169.1.2:10911] boot success... |
| ``` |
| |
| #### 1.2 多Master模式 |
| |
| 一个集群无Slave,全是Master,例如2个Master或者3个Master,这种模式的优缺点如下: |
| |
| - 优点:配置简单,单个Master宕机或重启维护对应用无影响,在磁盘配置为RAID10时,即使机器宕机不可恢复情况下,由于RAID10磁盘非常可靠,消息也不会丢(异步刷盘丢失少量消息,同步刷盘一条不丢),性能最高; |
| |
| - 缺点:单台机器宕机期间,这台机器上未被消费的消息在机器恢复之前不可订阅,消息实时性会受到影响。 |
| |
| ##### 1)启动NameServer |
| |
| NameServer需要先于Broker启动,且如果在生产环境使用,为了保证高可用,建议一般规模的集群启动3个NameServer,各节点的启动命令相同,如下: |
| |
| ```bash |
| ### 首先启动Name Server |
| $ nohup sh mqnamesrv & |
| |
| ### 验证Name Server 是否启动成功 |
| $ tail -f ~/logs/rocketmqlogs/namesrv.log |
| The Name Server boot success... |
| ``` |
| |
| ##### 2)启动Broker集群 |
| |
| ```bash |
| ### 在机器A,启动第一个Master,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-noslave/broker-a.properties & |
| |
| ### 在机器B,启动第二个Master,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-noslave/broker-b.properties & |
| |
| ... |
| ``` |
| |
| 如上启动命令是在单个NameServer情况下使用的。对于多个NameServer的集群,Broker启动命令中`-n`后面的地址列表用分号隔开即可,例如 `192.168.1.1:9876;192.161.2:9876`。 |
| |
| #### 1.3 多Master多Slave模式-异步复制 |
| |
| 每个Master配置一个Slave,有多对Master-Slave,HA采用异步复制方式,主备有短暂消息延迟(毫秒级),这种模式的优缺点如下: |
| |
| - 优点:即使磁盘损坏,消息丢失的非常少,且消息实时性不会受影响,同时Master宕机后,消费者仍然可以从Slave消费,而且此过程对应用透明,不需要人工干预,性能同多Master模式几乎一样; |
| |
| - 缺点:Master宕机,磁盘损坏情况下会丢失少量消息。 |
| |
| ##### 1)启动NameServer |
| |
| ```bash |
| ### 首先启动Name Server |
| $ nohup sh mqnamesrv & |
| |
| ### 验证Name Server 是否启动成功 |
| $ tail -f ~/logs/rocketmqlogs/namesrv.log |
| The Name Server boot success... |
| ``` |
| |
| ##### 2)启动Broker集群 |
| |
| ```bash |
| ### 在机器A,启动第一个Master,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-async/broker-a.properties & |
| |
| ### 在机器B,启动第二个Master,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-async/broker-b.properties & |
| |
| ### 在机器C,启动第一个Slave,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-async/broker-a-s.properties & |
| |
| ### 在机器D,启动第二个Slave,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-async/broker-b-s.properties & |
| ``` |
| |
| #### 1.4 多Master多Slave模式-同步双写 |
| |
| 每个Master配置一个Slave,有多对Master-Slave,HA采用同步双写方式,即只有主备都写成功,才向应用返回成功,这种模式的优缺点如下: |
| |
| - 优点:数据与服务都无单点故障,Master宕机情况下,消息无延迟,服务可用性与数据可用性都非常高; |
| |
| - 缺点:性能比异步复制模式略低(大约低10%左右),发送单个消息的RT会略高,且目前版本在主节点宕机后,备机不能自动切换为主机。 |
| |
| ##### 1)启动NameServer |
| |
| ```bash |
| ### 首先启动Name Server |
| $ nohup sh mqnamesrv & |
| |
| ### 验证Name Server 是否启动成功 |
| $ tail -f ~/logs/rocketmqlogs/namesrv.log |
| The Name Server boot success... |
| ``` |
| |
| ##### 2)启动Broker集群 |
| |
| ```bash |
| ### 在机器A,启动第一个Master,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-sync/broker-a.properties & |
| |
| ### 在机器B,启动第二个Master,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-sync/broker-b.properties & |
| |
| ### 在机器C,启动第一个Slave,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-sync/broker-a-s.properties & |
| |
| ### 在机器D,启动第二个Slave,例如NameServer的IP为:192.168.1.1 |
| $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-sync/broker-b-s.properties & |
| ``` |
| |
| 以上Broker与Slave配对是通过指定相同的BrokerName参数来配对,Master的BrokerId必须是0,Slave的BrokerId必须是大于0的数。另外一个Master下面可以挂载多个Slave,同一Master下的多个Slave通过指定不同的BrokerId来区分。$ROCKETMQ_HOME指的RocketMQ安装目录,需要用户自己设置此环境变量。 |
| |
| #### 1.5 RocketMQ 5.0 自动主从切换 |
| |
| RocketMQ 5.0 开始支持自动主从切换的模式,可参考以下文档 |
| |
| [快速开始](controller/quick_start.md) |
| |
| [部署文档](controller/deploy.md) |
| |
| [设计思想](controller/design.md) |
| |
| ### 2 mqadmin管理工具 |
| |
| > 注意: |
| > |
| > 1. 执行命令方法:`./mqadmin {command} {args}` |
| > 2. 几乎所有命令都需要配置-n表示NameServer地址,格式为ip:port |
| > 3. 几乎所有命令都可以通过-h获取帮助 |
| > 4. 如果既有Broker地址(-b)配置项又有clusterName(-c)配置项,则优先以Broker地址执行命令,如果不配置Broker地址,则对集群中所有主机执行命令,只支持一个Broker地址。-b格式为ip:port,port默认是10911 |
| > 5. 在tools下可以看到很多命令,但并不是所有命令都能使用,只有在MQAdminStartup中初始化的命令才能使用,你也可以修改这个类,增加或自定义命令 |
| > 6. 由于版本更新问题,少部分命令可能未及时更新,遇到错误请直接阅读相关命令源码 |
| |
| #### 2.1 Topic相关 |
| |
| <table border=0 cellpadding=0 cellspacing=0 width=714> |
| <col width=177> |
| <col width=175> |
| <col width=177> |
| <col width=185> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl63 width=177 style='height:17.0pt;width:133pt'>名称</td> |
| <td class=xl64 width=175 style='width:131pt'>含义</td> |
| <td class=xl64 width=177 style='width:133pt'>命令选项</td> |
| <td class=xl64 width=185 style='width:139pt'>说明</td> |
| </tr> |
| <tr height=132 style='height:99.0pt'> |
| <td rowspan=8 height=593 class=xl68 width=163 style='border-bottom:1.0pt; |
| height:444.0pt;border-top:none;width:122pt'>updateTopic</td> |
| <td rowspan=8 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>创建更新Topic配置</td> |
| <td class=xl65 width=149 style='width:112pt'>-b</td> |
| <td class=xl66 width=159 style='width:119pt'>Broker 地址,表示 topic 所在 |
| Broker,只支持单台Broker,地址为ip:port</td> |
| </tr> |
| <tr height=132 style='height:99.0pt'> |
| <td height=132 class=xl65 width=149 style='height:99.0pt;width:112pt'>-c</td> |
| <td class=xl66 width=159 style='width:119pt'>cluster 名称,表示 topic 所在集群(集群可通过 |
| clusterList 查询)</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=149 style='height:17.0pt;width:112pt'>-h-</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=76 style='height:57.0pt'> |
| <td height=76 class=xl65 width=149 style='height:57.0pt;width:112pt'>-p</td> |
| <td class=xl66 width=159 style='width:119pt'>指定新topic的读写权限( W=2|R=4|WR=6 )</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl65 width=149 style='height:29.0pt;width:112pt'>-r</td> |
| <td class=xl66 width=159 style='width:119pt'>可读队列数(默认为 8)</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl65 width=149 style='height:29.0pt;width:112pt'>-w</td> |
| <td class=xl66 width=159 style='width:119pt'>可写队列数(默认为 8)</td> |
| </tr> |
| <tr height=95 style='height:71.0pt'> |
| <td height=95 class=xl65 width=149 style='height:71.0pt;width:112pt'>-t</td> |
| <td class=xl66 width=159 style='width:119pt'>topic 名称(名称只能使用字符 |
| ^[a-zA-Z0-9_-]+$ )</td> |
| </tr> |
| <tr height=132 style='height:99.0pt'> |
| <td rowspan=4 height=307 class=xl68 width=163 style='border-bottom:1.0pt; |
| height:230.0pt;border-top:none;width:122pt'>deleteTopic</td> |
| <td rowspan=4 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>删除Topic</td> |
| <td class=xl65 width=149 style='width:112pt'>-c</td> |
| <td class=xl66 width=159 style='width:119pt'>cluster 名称,表示删除某集群下的某个 topic (集群 |
| 可通过 clusterList 查询)</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=149 style='height:17.0pt;width:112pt'>-h</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=95 style='height:71.0pt'> |
| <td height=95 class=xl65 width=149 style='height:71.0pt;width:112pt'>-t</td> |
| <td class=xl66 width=159 style='width:119pt'>topic 名称(名称只能使用字符 |
| ^[a-zA-Z0-9_-]+$ )</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=3 height=287 class=xl68 width=163 style='border-bottom:1.0pt; |
| height:215.0pt;border-top:none;width:122pt'>topicList</td> |
| <td rowspan=3 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>查看 Topic 列表信息</td> |
| <td class=xl65 width=149 style='width:112pt'>-h</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=207 style='height:155.0pt'> |
| <td height=207 class=xl65 width=149 style='height:155.0pt;width:112pt'>-c</td> |
| <td class=xl66 width=159 style='width:119pt'>不配置-c只返回topic列表,增加-c返回clusterName, |
| topic, consumerGroup信息,即topic的所属集群和订阅关系,没有参数</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=3 height=103 class=xl68 width=163 style='border-bottom:1.0pt; |
| height:77.0pt;border-top:none;width:122pt'>topicRoute</td> |
| <td rowspan=3 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>查看 Topic 路由信息</td> |
| <td class=xl65 width=149 style='width:112pt'>-t</td> |
| <td class=xl66 width=159 style='width:119pt'>topic 名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=149 style='height:17.0pt;width:112pt'>-h</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=3 height=103 class=xl68 width=163 style='border-bottom:1.0pt; |
| height:77.0pt;border-top:none;width:122pt'>topicStatus</td> |
| <td rowspan=3 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>查看 Topic 消息队列offset</td> |
| <td class=xl65 width=149 style='width:112pt'>-t</td> |
| <td class=xl66 width=159 style='width:119pt'>topic 名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=149 style='height:17.0pt;width:112pt'>-h</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=3 height=103 class=xl68 width=163 style='border-bottom:1.0pt; |
| height:77.0pt;border-top:none;width:122pt'>topicClusterList</td> |
| <td rowspan=3 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>查看 Topic 所在集群列表</td> |
| <td class=xl65 width=149 style='width:112pt'>-t</td> |
| <td class=xl66 width=159 style='width:119pt'>topic 名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=149 style='height:17.0pt;width:112pt'>-h</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=6 height=518 class=xl68 width=163 style='border-bottom:1.0pt; |
| height:380pt;border-top:none;width:122pt'>updateTopicPerm</td> |
| <td rowspan=6 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>更新 Topic 读写权限</td> |
| <td class=xl65 width=149 style='width:112pt'>-t</td> |
| <td class=xl66 width=159 style='width:119pt'>topic 名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=149 style='height:17.0pt;width:112pt'>-h</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=132 style='height:99.0pt'> |
| <td height=132 class=xl65 width=149 style='height:99.0pt;width:112pt'>-b</td> |
| <td class=xl66 width=159 style='width:119pt'>Broker 地址,表示 topic 所在 |
| Broker,只支持单台Broker,地址为ip:port</td> |
| </tr> |
| <tr height=76 style='height:57.0pt'> |
| <td height=76 class=xl65 width=149 style='height:57.0pt;width:112pt'>-p</td> |
| <td class=xl66 width=159 style='width:119pt'>指定新 topic 的读写权限( W=2|R=4|WR=6 )</td> |
| </tr> |
| <tr height=207 style='height:155.0pt'> |
| <td height=207 class=xl65 width=149 style='height:155.0pt;width:112pt'>-c</td> |
| <td class=xl66 width=159 style='width:119pt'>cluster 名称,表示 topic 所在集群(集群可通过 |
| clusterList 查询),-b优先,如果没有-b,则对集群中所有Broker执行命令</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=5 height=199 class=xl68 width=163 style='border-bottom:1.0pt; |
| height:149.0pt;border-top:none;width:122pt'>updateOrderConf</td> |
| <td rowspan=5 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>从NameServer上创建、删除、获取特定命名空间的kv配置,目前还未启用</td> |
| <td class=xl65 width=149 style='width:112pt'>-h</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=149 style='height:17.0pt;width:112pt'>-t</td> |
| <td class=xl66 width=159 style='width:119pt'>topic,键</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl65 width=149 style='height:29.0pt;width:112pt'>-v</td> |
| <td class=xl66 width=159 style='width:119pt'>orderConf,值</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-m</td> |
| <td class=xl66 width=159 style='width:119pt'>method,可选get、put、delete</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=4 height=198 class=xl68 width=163 style='border-bottom:1.0pt; |
| height:140pt;border-top:none;width:122pt'>allocateMQ</td> |
| <td rowspan=4 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>以平均负载算法计算消费者列表负载消息队列的负载结果</td> |
| <td class=xl65 width=149 style='width:112pt'>-t</td> |
| <td class=xl66 width=159 style='width:119pt'>topic 名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=149 style='height:17.0pt;width:112pt'>-h</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=95 style='height:71.0pt'> |
| <td height=95 class=xl65 width=149 style='height:71.0pt;width:112pt'>-i</td> |
| <td class=xl66 width=159 style='width:119pt'>ipList,用逗号分隔,计算这些ip去负载Topic的消息队列</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=4 height=142 class=xl68 width=163 style='border-bottom:1.0pt solid black; |
| height:106.0pt;border-top:1.0pt;width:122pt'>statsAll</td> |
| <td rowspan=4 class=xl70 width=135 style='border-bottom:1.0pt; |
| border-top:none;width:101pt'>打印Topic订阅关系、TPS、积累量、24h读写总量等信息</td> |
| <td class=xl65 width=149 style='width:112pt'>-h</td> |
| <td class=xl66 width=159 style='width:119pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=149 style='height:43.0pt;width:112pt'>-n</td> |
| <td class=xl66 width=159 style='width:119pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl65 width=149 style='height:29.0pt;width:112pt'>-a</td> |
| <td class=xl66 width=159 style='width:119pt'>是否只打印活跃topic</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=149 style='height:17.0pt;width:112pt'>-t</td> |
| <td class=xl66 width=159 style='width:119pt'>指定topic</td> |
| </tr> |
| </table> |
| |
| |
| |
| #### 2.2 集群相关 |
| |
| <table border=0 cellpadding=0 cellspacing=0 width=714> |
| <col width=177> |
| <col width=175> |
| <col width=177> |
| <col width=185> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl63 width=177 style='height:17.0pt;width:133pt'>名称</td> |
| <td class=xl64 width=175 style='width:131pt'>含义</td> |
| <td class=xl64 width=177 style='width:133pt'>命令选项</td> |
| <td class=xl64 width=185 style='width:139pt'>说明</td> |
| </tr> |
| <tr height=207 style='height:155.0pt'> |
| <td rowspan=4 height=326 class=xl67 width=177 style='border-bottom:1.0pt; |
| height:244.0pt;border-top:none;width:133pt'><span |
| style='mso-spacerun:yes'> </span>clusterList</td> |
| <td rowspan=4 class=xl70 width=175 style='border-bottom:1.0pt; |
| border-top:none;width:131pt'>查看集群信息,集群、BrokerName、BrokerId、TPS等信息</td> |
| <td class=xl65 width=177 style='width:133pt'>-m</td> |
| <td class=xl66 width=185 style='width:139pt'>打印更多信息 (增加打印出如下信息 #InTotalYest, |
| #OutTotalYest, #InTotalToday ,#OutTotalToday)</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=177 style='height:17.0pt;width:133pt'>-h</td> |
| <td class=xl66 width=185 style='width:139pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=177 style='height:43.0pt;width:133pt'>-n</td> |
| <td class=xl66 width=185 style='width:139pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl65 width=177 style='height:29.0pt;width:133pt'>-i</td> |
| <td class=xl66 width=185 style='width:139pt'>打印间隔,单位秒</td> |
| </tr> |
| <tr height=95 style='height:71.0pt'> |
| <td rowspan=8 height=391 class=xl67 width=177 style='border-bottom:1.0pt; |
| height:292.0pt;border-top:none;width:133pt'>clusterRT</td> |
| <td rowspan=8 class=xl70 width=175 style='border-bottom:1.0pt; |
| border-top:none;width:131pt'>发送消息检测集群各Broker RT。消息发往${BrokerName} Topic。</td> |
| <td class=xl65 width=177 style='width:133pt'>-a</td> |
| <td class=xl66 width=185 style='width:139pt'>amount,每次探测的总数,RT = 总时间 / |
| amount</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl65 width=177 style='height:29.0pt;width:133pt'>-s</td> |
| <td class=xl66 width=185 style='width:139pt'>消息大小,单位B</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=177 style='height:17.0pt;width:133pt'>-c</td> |
| <td class=xl66 width=185 style='width:139pt'>探测哪个集群</td> |
| </tr> |
| <tr height=76 style='height:57.0pt'> |
| <td height=76 class=xl65 width=177 style='height:57.0pt;width:133pt'>-p</td> |
| <td class=xl66 width=185 style='width:139pt'>是否打印格式化日志,以|分割,默认不打印</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl65 width=177 style='height:17.0pt;width:133pt'>-h</td> |
| <td class=xl66 width=185 style='width:139pt'>打印帮助</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl65 width=177 style='height:29.0pt;width:133pt'>-m</td> |
| <td class=xl66 width=185 style='width:139pt'>所属机房,打印使用</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl65 width=177 style='height:29.0pt;width:133pt'>-i</td> |
| <td class=xl66 width=185 style='width:139pt'>发送间隔,单位秒</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl65 width=177 style='height:43.0pt;width:133pt'>-n</td> |
| <td class=xl66 width=185 style='width:139pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| </table> |
| |
| |
| #### 2.3 Broker相关 |
| |
| <table border=0 cellpadding=0 cellspacing=0 width=714> |
| <col width=177> |
| <col width=175> |
| <col width=177> |
| <col width=185> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl63 width=177 style='height:17.0pt;width:133pt'>名称</td> |
| <td class=xl64 width=175 style='width:131pt'>含义</td> |
| <td class=xl64 width=177 style='width:133pt'>命令选项</td> |
| <td class=xl64 width=185 style='width:139pt'>说明</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=6 height=206 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:154.0pt;border-top:none;width:143pt'>updateBrokerConfig</td> |
| <td rowspan=6 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>更新 Broker 配置文件,会修改Broker.conf</td> |
| <td class=xl67 width=87 style='width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker 地址,格式为ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>cluster 名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-k</td> |
| <td class=xl68 width=87 style='width:65pt'>key 值</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-v</td> |
| <td class=xl68 width=87 style='width:65pt'>value 值</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=3 height=137 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:103.0pt;border-top:none;width:143pt'>brokerStatus</td> |
| <td rowspan=3 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>查看 Broker 统计信息、运行状态(你想要的信息几乎都在里面)</td> |
| <td class=xl67 width=87 style='width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker 地址,地址为ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=6 height=256 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:192.0pt;border-top:none;width:143pt'>brokerConsumeStats</td> |
| <td rowspan=6 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>Broker中各个消费者的消费情况,按Message Queue维度返回Consume |
| Offset,Broker Offset,Diff,TImestamp等信息</td> |
| <td class=xl67 width=87 style='width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker 地址,地址为ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>请求超时时间</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-l</td> |
| <td class=xl68 width=87 style='width:65pt'>diff阈值,超过阈值才打印</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-o</td> |
| <td class=xl68 width=87 style='width:65pt'>是否为顺序topic,一般为false</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=2 height=114 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:86.0pt;border-top:none;width:143pt'>getBrokerConfig</td> |
| <td rowspan=2 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>获取Broker配置</td> |
| <td class=xl67 width=87 style='width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker 地址,地址为ip:port</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=3 height=137 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:103.0pt;border-top:none;width:143pt'>wipeWritePerm</td> |
| <td rowspan=3 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>从NameServer上清除 Broker写权限</td> |
| <td class=xl67 width=87 style='width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>BrokerName</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=3 height=137 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:103.0pt;border-top:none;width:143pt'>addWritePerm</td> |
| <td rowspan=3 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>从NameServer上添加 Broker写权限</td> |
| <td class=xl67 width=87 style='width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>BrokerName</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=4 height=160 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:120.0pt;border-top:none;width:143pt'>cleanExpiredCQ</td> |
| <td rowspan=4 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>清理Broker上过期的Consume Queue,如果手动减少对列数可能产生过期队列</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker 地址,地址为ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>集群名称</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=4 height=160 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:120.0pt;border-top:none;width:143pt'>deleteExpiredCommitLog</td> |
| <td rowspan=4 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>清理Broker上过期的CommitLog文件,Broker最多会执行20次删除操作,每次最多删除10个文件</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker 地址,地址为ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>集群名称</td> |
| </tr> |
| <tr height=88 style='mso-height-source:userset;height:66.0pt'> |
| <td rowspan=4 height=191 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:143.0pt;border-top:none;width:143pt'>cleanUnusedTopic</td> |
| <td rowspan=4 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>清理Broker上不使用的Topic,从内存中释放Topic的Consume |
| Queue,如果手动删除Topic会产生不使用的Topic</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker 地址,地址为ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>集群名称</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=5 height=199 class=xl69 width=191 style='border-bottom:1.0pt; |
| height:149.0pt;border-top:none;width:143pt'>sendMsgStatus</td> |
| <td rowspan=5 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>向Broker发消息,返回发送状态和RT</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>BrokerName,注意不同于Broker地址</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>消息大小,单位B</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>发送次数</td> |
| </tr> |
| </table> |
| |
| |
| #### 2.4 消息相关 |
| |
| <table border=0 cellpadding=0 cellspacing=0 width=714> |
| <col width=177> |
| <col width=175> |
| <col width=177> |
| <col width=185> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl63 width=177 style='height:17.0pt;width:133pt'>名称</td> |
| <td class=xl64 width=175 style='width:131pt'>含义</td> |
| <td class=xl64 width=177 style='width:133pt'>命令选项</td> |
| <td class=xl64 width=185 style='width:139pt'>说明</td> |
| </tr> |
| <tr height=128 style='height:96.0pt'> |
| <td rowspan=3 height=208 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:156.0pt;border-top:none;width:65pt'>queryMsgById</td> |
| <td rowspan=3 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>根据offsetMsgId查询msg,如果使用开源控制台,应使用offsetMsgId,此命令还有其他参数,具体作用请阅读QueryMsgByIdSubCommand。</td> |
| <td class=xl67 width=87 style='width:65pt'>-i</td> |
| <td class=xl67 width=87 style='width:65pt'>msgId</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=4 height=126 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:94.0pt;border-top:none;width:65pt'>queryMsgByKey</td> |
| <td rowspan=4 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>根据消息 Key 查询消息</td> |
| <td class=xl67 width=87 style='width:65pt'>-k</td> |
| <td class=xl67 width=87 style='width:65pt'>msgKey</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>Topic 名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=225 style='height:169.0pt'> |
| <td rowspan=6 height=390 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:292.0pt;border-top:none;width:65pt'>queryMsgByOffset</td> |
| <td rowspan=6 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>根据 Offset 查询消息</td> |
| <td class=xl67 width=87 style='width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker 名称,(这里需要注意 |
| 填写的是 Broker 的名称,不是 Broker 的地址,Broker 名称可以在 clusterList 查到)</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-i</td> |
| <td class=xl68 width=87 style='width:65pt'>query 队列 id</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-o</td> |
| <td class=xl68 width=87 style='width:65pt'>offset 值</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>topic 名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=47> |
| <td rowspan=6 height=209 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:156.0pt;border-top:none;width:65pt'>queryMsgByUniqueKey</td> |
| <td rowspan=6 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>根据msgId查询,msgId不同于offsetMsgId,区别详见常见运维问题。-g,-d配合使用,查到消息后尝试让特定的消费者消费消息并返回消费结果</td> |
| <td class=xl67 width=87 style='width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-i</td> |
| <td class=xl67 width=87 style='width:65pt'>uniqe msg id</td> |
| </tr> |
| <tr height=36 style='height:27.0pt'> |
| <td height=36 class=xl67 width=87 style='height:27.0pt;width:65pt'>-g</td> |
| <td class=xl67 width=87 style='width:65pt'>consumerGroup</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-d</td> |
| <td class=xl67 width=87 style='width:65pt'>clientId</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>topic名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=5 height=149 class=xl69 width=87 style='border-bottom:1.0pt |
| height:111.0pt;border-top:none;width:65pt'>checkMsgSendRT</td> |
| <td rowspan=5 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>检测向topic发消息的RT,功能类似clusterRT</td> |
| <td class=xl67 width=87 style='width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>topic名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-a</td> |
| <td class=xl68 width=87 style='width:65pt'>探测次数</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>消息大小</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=8 height=218 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:162.0pt;border-top:none;width:65pt'>sendMessage</td> |
| <td rowspan=8 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>发送一条消息,可以根据配置发往特定Message Queue,或普通发送。</td> |
| <td class=xl67 width=87 style='width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>topic名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-p</td> |
| <td class=xl68 width=87 style='width:65pt'>body,消息体</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-k</td> |
| <td class=xl67 width=87 style='width:65pt'>keys</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-c</td> |
| <td class=xl67 width=87 style='width:65pt'>tags</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-b</td> |
| <td class=xl67 width=87 style='width:65pt'>BrokerName</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-i</td> |
| <td class=xl67 width=87 style='width:65pt'>queueId</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=10 height=312 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:232.0pt;border-top:none;width:65pt'>consumeMessage</td> |
| <td rowspan=10 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>消费消息。可以根据offset、开始&结束时间戳、消息队列消费消息,配置不同执行不同消费逻辑,详见ConsumeMessageCommand。</td> |
| <td class=xl67 width=87 style='width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>topic名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-b</td> |
| <td class=xl67 width=87 style='width:65pt'>BrokerName</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-o</td> |
| <td class=xl68 width=87 style='width:65pt'>从offset开始消费</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-i</td> |
| <td class=xl67 width=87 style='width:65pt'>queueId</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-g</td> |
| <td class=xl68 width=87 style='width:65pt'>消费者分组</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>开始时间戳,格式详见-h</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-d</td> |
| <td class=xl68 width=87 style='width:65pt'>结束时间戳</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>消费多少条消息</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=8 height=282 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:210.0pt;border-top:none;width:65pt'>printMsg</td> |
| <td rowspan=8 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>从Broker消费消息并打印,可选时间段</td> |
| <td class=xl67 width=87 style='width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>topic名称</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>字符集,例如UTF-8</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>subExpress,过滤表达式</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>开始时间戳,格式参见-h</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-e</td> |
| <td class=xl68 width=87 style='width:65pt'>结束时间戳</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-d</td> |
| <td class=xl68 width=87 style='width:65pt'>是否打印消息体</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=12 height=390 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:290.0pt;border-top:none;width:65pt'>printMsgByQueue</td> |
| <td rowspan=12 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>类似printMsg,但指定Message Queue</td> |
| <td class=xl67 width=87 style='width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>topic名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-i</td> |
| <td class=xl67 width=87 style='width:65pt'>queueId</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-a</td> |
| <td class=xl67 width=87 style='width:65pt'>BrokerName</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>字符集,例如UTF-8</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>subExpress,过滤表达式</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>开始时间戳,格式参见-h</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-e</td> |
| <td class=xl68 width=87 style='width:65pt'>结束时间戳</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-p</td> |
| <td class=xl68 width=87 style='width:65pt'>是否打印消息</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-d</td> |
| <td class=xl68 width=87 style='width:65pt'>是否打印消息体</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-f</td> |
| <td class=xl68 width=87 style='width:65pt'>是否统计tag数量并打印</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=7 height=410 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:307.0pt;border-top:none;width:65pt'>resetOffsetByTime</td> |
| <td rowspan=7 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>按时间戳重置offset,Broker和consumer都会重置</td> |
| <td class=xl67 width=87 style='width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-g</td> |
| <td class=xl68 width=87 style='width:65pt'>消费者分组</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>topic名称</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>重置为此时间戳对应的offset</td> |
| </tr> |
| <tr height=188 style='height:141.0pt'> |
| <td height=188 class=xl67 width=87 style='height:141.0pt;width:65pt'>-f</td> |
| <td class=xl68 width=87 style='width:65pt'>是否强制重置,如果false,只支持回溯offset,如果true,不管时间戳对应offset与consumeOffset关系</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>是否重置c++客户端offset</td> |
| </tr> |
| </table> |
| |
| |
| #### 2.5 消费者、消费组相关 |
| |
| <table border=0 cellpadding=0 cellspacing=0 width=714> |
| <col width=177> |
| <col width=175> |
| <col width=177> |
| <col width=185> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl63 width=177 style='height:17.0pt;width:133pt'>名称</td> |
| <td class=xl64 width=175 style='width:131pt'>含义</td> |
| <td class=xl64 width=177 style='width:133pt'>命令选项</td> |
| <td class=xl64 width=185 style='width:139pt'>说明</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td rowspan=4 height=158 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:110pt;border-top:none;width:65pt'>consumerProgress</td> |
| <td rowspan=4 class=xl72 width=87 style='border-bottom:1.0pt; |
| border-top:none;width:65pt'>查看订阅组消费状态,可以查看具体的client IP的消息积累量</td> |
| <td class=xl67 width=87 style='width:65pt'>-g</td> |
| <td class=xl68 width=87 style='width:65pt'>消费者所属组名</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>是否打印client IP</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=105 style='mso-height-source:userset;height:79.0pt'> |
| <td rowspan=5 height=260 class=xl69 width=87 style='border-bottom:1.0pt; |
| height:195.0pt;border-top:none;width:65pt'>consumerStatus</td> |
| <td rowspan=5 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>查看消费者状态,包括同一个分组中是否都是相同的订阅,分析Process |
| Queue是否堆积,返回消费者jstack结果,内容较多,使用者参见ConsumerStatusSubCommand</td> |
| <td class=xl67 width=87 style='width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=36 style='height:27.0pt'> |
| <td height=36 class=xl67 width=87 style='height:27.0pt;width:65pt'>-g</td> |
| <td class=xl67 width=87 style='width:65pt'>consumer group</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-i</td> |
| <td class=xl67 width=87 style='width:65pt'>clientId</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>是否执行jstack</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=13 height=761 class=xl69 width=87 style='border-bottom:1.0pt |
| height:569.0pt;border-top:none;width:65pt'>updateSubGroup</td> |
| <td rowspan=13 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>更新或创建订阅关系</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker地址</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>集群名称</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-g</td> |
| <td class=xl68 width=87 style='width:65pt'>消费者分组名称</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>分组是否允许消费</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-m</td> |
| <td class=xl68 width=87 style='width:65pt'>是否从最小offset开始消费</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-d</td> |
| <td class=xl68 width=87 style='width:65pt'>是否是广播模式</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-q</td> |
| <td class=xl68 width=87 style='width:65pt'>重试队列数量</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-r</td> |
| <td class=xl68 width=87 style='width:65pt'>最大重试次数</td> |
| </tr> |
| <tr height=207 style='height:155.0pt'> |
| <td height=207 class=xl67 width=87 style='height:155.0pt;width:65pt'>-i</td> |
| <td class=xl68 width=87 style='width:65pt'>当slaveReadEnable开启时有效,且还未达到从slave消费时建议从哪个BrokerId消费,可以配置备机id,主动从备机消费</td> |
| </tr> |
| <tr height=132 style='height:99.0pt'> |
| <td height=132 class=xl67 width=87 style='height:99.0pt;width:65pt'>-w</td> |
| <td class=xl68 width=87 style='width:65pt'>如果Broker建议从slave消费,配置决定从哪个slave消费,配置BrokerId,例如1</td> |
| </tr> |
| <tr height=76 style='height:57.0pt'> |
| <td height=76 class=xl67 width=87 style='height:57.0pt;width:65pt'>-a</td> |
| <td class=xl68 width=87 style='width:65pt'>当消费者数量变化时是否通知其他消费者负载均衡</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=5 height=165 class=xl69 width=87 style='border-bottom:1.0pt |
| height:123.0pt;border-top:none;width:65pt'>deleteSubGroup</td> |
| <td rowspan=5 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>从Broker删除订阅关系</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-b</td> |
| <td class=xl68 width=87 style='width:65pt'>Broker地址</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-c</td> |
| <td class=xl68 width=87 style='width:65pt'>集群名称</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td height=39 class=xl67 width=87 style='height:29.0pt;width:65pt'>-g</td> |
| <td class=xl68 width=87 style='width:65pt'>消费者分组名称</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=6 height=172 class=xl69 width=87 style='border-bottom:1.0pt |
| height:120pt;border-top:none;width:65pt'>cloneGroupOffset</td> |
| <td rowspan=6 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>在目标群组中使用源群组的offset</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>源消费者组</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-d</td> |
| <td class=xl68 width=87 style='width:65pt'>目标消费者组</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>topic名称</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-o</td> |
| <td class=xl68 width=87 style='width:65pt'>暂未使用</td> |
| </tr> |
| </table> |
| |
| |
| |
| |
| #### 2.6 连接相关 |
| |
| <table border=0 cellpadding=0 cellspacing=0 width=714> |
| <col width=177> |
| <col width=175> |
| <col width=177> |
| <col width=185> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl63 width=177 style='height:17.0pt;width:133pt'>名称</td> |
| <td class=xl64 width=175 style='width:131pt'>含义</td> |
| <td class=xl64 width=177 style='width:133pt'>命令选项</td> |
| <td class=xl64 width=185 style='width:139pt'>说明</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td rowspan=3 height=119 class=xl69 width=87 style='border-bottom:1.0pt |
| height:89.0pt;border-top:none;width:65pt'>consumerConnection</td> |
| <td rowspan=3 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>查询 Consumer 的网络连接</td> |
| <td class=xl67 width=87 style='width:65pt'>-g</td> |
| <td class=xl68 width=87 style='width:65pt'>消费者所属组名</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=39 style='height:29.0pt'> |
| <td rowspan=4 height=142 class=xl69 width=87 style='border-bottom:1.0pt |
| height:106.0pt;border-top:none;width:65pt'>producerConnection</td> |
| <td rowspan=4 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>查询 Producer 的网络连接</td> |
| <td class=xl67 width=87 style='width:65pt'>-g</td> |
| <td class=xl68 width=87 style='width:65pt'>生产者所属组名</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-t</td> |
| <td class=xl68 width=87 style='width:65pt'>主题名称</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| </table> |
| |
| |
| |
| |
| #### 2.7 NameServer相关 |
| |
| <table border=0 cellpadding=0 cellspacing=0 width=714> |
| <col width=177> |
| <col width=175> |
| <col width=177> |
| <col width=185> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl63 width=177 style='height:17.0pt;width:133pt'>名称</td> |
| <td class=xl64 width=175 style='width:131pt'>含义</td> |
| <td class=xl64 width=177 style='width:133pt'>命令选项</td> |
| <td class=xl64 width=185 style='width:139pt'>说明</td> |
| </tr> |
| <tr height=21 style='height:16.0pt'> |
| <td rowspan=5 height=143 class=xl69 width=87 style='border-bottom:1.0pt |
| height:100pt;border-top:none;width:65pt'>updateKvConfig</td> |
| <td rowspan=5 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>更新NameServer的kv配置,目前还未使用</td> |
| <td class=xl75 width=87 style='width:65pt'>-s</td> |
| <td class=xl76 width=87 style='width:65pt'>命名空间</td> |
| </tr> |
| <tr height=21 style='height:16.0pt'> |
| <td height=21 class=xl75 width=87 style='height:16.0pt;width:65pt'>-k</td> |
| <td class=xl75 width=87 style='width:65pt'>key</td> |
| </tr> |
| <tr height=21 style='height:16.0pt'> |
| <td height=21 class=xl75 width=87 style='height:16.0pt;width:65pt'>-v</td> |
| <td class=xl75 width=87 style='width:65pt'>value</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td rowspan=4 height=126 class=xl69 width=87 style='border-bottom:1.0pt |
| height:94.0pt;border-top:none;width:65pt'>deleteKvConfig</td> |
| <td rowspan=4 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>删除NameServer的kv配置</td> |
| <td class=xl67 width=87 style='width:65pt'>-s</td> |
| <td class=xl68 width=87 style='width:65pt'>命名空间</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-k</td> |
| <td class=xl67 width=87 style='width:65pt'>key</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=2 height=80 class=xl69 width=87 style='border-bottom:1.0pt |
| height:60.0pt;border-top:none;width:65pt'>getNamesrvConfig</td> |
| <td rowspan=2 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>获取NameServer配置</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=4 height=126 class=xl69 width=87 style='border-bottom:1.0pt |
| height:94.0pt;border-top:none;width:65pt'>updateNamesrvConfig</td> |
| <td rowspan=4 class=xl72 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>修改NameServer配置</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-k</td> |
| <td class=xl67 width=87 style='width:65pt'>key</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-v</td> |
| <td class=xl67 width=87 style='width:65pt'>value</td> |
| </tr> |
| </table> |
| |
| |
| |
| |
| #### 2.8 其他 |
| |
| <table border=0 cellpadding=0 cellspacing=0 width=714> |
| <col width=177> |
| <col width=175> |
| <col width=177> |
| <col width=185> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl63 width=177 style='height:17.0pt;width:133pt'>名称</td> |
| <td class=xl64 width=175 style='width:131pt'>含义</td> |
| <td class=xl64 width=177 style='width:133pt'>命令选项</td> |
| <td class=xl64 width=185 style='width:139pt'>说明</td> |
| </tr> |
| <tr height=57 style='height:43.0pt'> |
| <td rowspan=2 height=80 class=xl69 width=87 style='border-bottom:1.0pt |
| height:60.0pt;border-top:none;width:65pt'>startMonitoring</td> |
| <td rowspan=2 class=xl71 width=87 style='border-bottom:1.0pt |
| border-top:none;width:65pt'>开启监控进程,监控消息误删、重试队列消息数等</td> |
| <td class=xl67 width=87 style='width:65pt'>-n</td> |
| <td class=xl68 width=87 style='width:65pt'>NameServer 服务地址,格式 ip:port</td> |
| </tr> |
| <tr height=23 style='height:17.0pt'> |
| <td height=23 class=xl67 width=87 style='height:17.0pt;width:65pt'>-h</td> |
| <td class=xl68 width=87 style='width:65pt'>打印帮助</td> |
| </tr> |
| </table> |
| |
| |
| ### 3 运维常见问题 |
| |
| #### 3.1 RocketMQ的mqadmin命令报错问题 |
| |
| > 问题描述:有时候在部署完RocketMQ集群后,尝试执行“mqadmin”一些运维命令,会出现下面的异常信息: |
| > |
| > ```java |
| > org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to <null> failed |
| > ``` |
| |
| 解决方法:可以在部署RocketMQ集群的虚拟机上执行`export NAMESRV_ADDR=ip:9876`(ip指的是集群中部署NameServer组件的机器ip地址)命令之后再使用“mqadmin”的相关命令进行查询,即可得到结果。 |
| |
| #### 3.2 RocketMQ生产端和消费端版本不一致导致不能正常消费的问题 |
| |
| > 问题描述:同一个生产端发出消息,A消费端可消费,B消费端却无法消费,rocketMQ Console中出现: |
| > |
| > ```java |
| > Not found the consumer group consume stats, because return offset table is empty, maybe the consumer not consume any message的异常消息。 |
| > ``` |
| |
| 解决方案:RocketMQ 的jar包:rocketmq-client等包应该保持生产端,消费端使用相同的version。 |
| |
| #### 3.3 新增一个topic的消费组时,无法消费历史消息的问题 |
| |
| > 问题描述:当同一个topic的新增消费组启动时,消费的消息是当前的offset的消息,并未获取历史消息。 |
| |
| 解决方案:rocketmq默认策略是从消息队列尾部,即跳过历史消息。如果想消费历史消息,则需要设置:`org.apache.rocketmq.client.consumer.DefaultMQPushConsumer#setConsumeFromWhere`。常用的有以下三种配置: |
| |
| - 默认配置,一个新的订阅组第一次启动从队列的最后位置开始消费,后续再启动接着上次消费的进度开始消费,即跳过历史消息; |
| |
| ```java |
| consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET); |
| ``` |
| |
| - 一个新的订阅组第一次启动从队列的最前位置开始消费,后续再启动接着上次消费的进度开始消费,即消费Broker未过期的历史消息; |
| |
| ```java |
| consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); |
| ``` |
| |
| - 一个新的订阅组第一次启动从指定时间点开始消费,后续再启动接着上次消费的进度开始消费,和consumer.setConsumeTimestamp()配合使用,默认是半个小时以前; |
| |
| ```java |
| consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_TIMESTAMP); |
| ``` |
| |
| #### 3.4 如何开启从Slave读数据功能 |
| |
| 在某些情况下,Consumer需要将消费位点重置到1-2天前,这时在内存有限的Master Broker上,CommitLog会承载比较重的IO压力,影响到该Broker的其它消息的读与写。可以开启`slaveReadEnable=true`,当Master Broker发现Consumer的消费位点与CommitLog的最新值的差值的容量超过该机器内存的百分比(`accessMessageInMemoryMaxRatio=40%`),会推荐Consumer从Slave Broker中去读取数据,降低Master Broker的IO。 |
| |
| #### 3.5 性能调优问题 |
| |
| 异步刷盘建议使用自旋锁,同步刷盘建议使用重入锁,调整Broker配置项`useReentrantLockWhenPutMessage`,默认为false;异步刷盘建议开启`TransientStorePoolEnable`;建议关闭transferMsgByHeap,提高拉消息效率;同步刷盘建议适当增大`sendMessageThreadPoolNums`,具体配置需要经过压测。 |
| |
| #### 3.6 在RocketMQ中msgId和offsetMsgId的含义与区别 |
| |
| 使用RocketMQ完成生产者客户端消息发送后,通常会看到如下日志打印信息: |
| |
| ```java |
| SendResult [sendStatus=SEND_OK, msgId=0A42333A0DC818B4AAC246C290FD0000, offsetMsgId=0A42333A00002A9F000000000134F1F5, messageQueue=MessageQueue [topic=topicTest1, BrokerName=mac.local, queueId=3], queueOffset=4] |
| ``` |
| |
| - msgId,对于客户端来说msgId是由客户端producer实例端生成的,具体来说,调用方法`MessageClientIDSetter.createUniqIDBuffer()`生成唯一的Id; |
| - offsetMsgId,offsetMsgId是由Broker服务端在写入消息时生成的(采用”IP地址+Port端口”与“CommitLog的物理偏移量地址”做了一个字符串拼接),其中offsetMsgId就是在RocketMQ控制台直接输入查询的那个messageId。 |