wlliqipeng commented on a change in pull request #654: [RIP-9]Add the operation 
part
URL: https://github.com/apache/rocketmq/pull/654#discussion_r250061188
 
 

 ##########
 File path: docs/cn/operation.md
 ##########
 @@ -0,0 +1,1408 @@
+## 运维管理(operation)
+
+### 1   集群搭建
+
+#### 1.1 单Master模式
+
+这种方式风险较大,一旦Broker重启或者宕机时,会导致整个服务不可用。不建议线上环境使用,可以用于本地测试。
+
+##### 1)启动 NameServer
+
+```bash
+### 首先启动Name Server,例如机器IP为:192.161.1:9876
+$ nohup sh mqnamesrv &
+ 
+### 验证Name Server 是否启动成功
+$ tail -f ~/logs/rocketmqlogs/namesrv.log
+The Name Server boot success...
+```
+
+##### 2)启动 Broker
+
+```bash
+### 启动Broker,例如机器IP为:192.161.1:9876
+$ nohup sh bin/mqbroker -n localhost:9876 &
+### 验证Name Server 是否启动成功
+$ tail -f ~/logs/rocketmqlogs/Broker.log 
+The broker[%s, 172.30.30.233:10911] boot success...
+```
+
+#### 1.2 多Master模式
+
+一个集群无Slave,全是Master,例如2个Master或者3个Master,这种模式的优缺点如下:
+
+- 
优点:配置简单,单个Master宕机或重启维护对应用无影响,在磁盘配置为RAID10时,即使机器宕机不可恢复情况下,由于RAID10磁盘非常可靠,消息也不会丢(异步刷盘丢失少量消息,同步刷盘一条不丢)。性能最高;
+
+- 缺点:单台机器宕机期间,这台机器上未被消费的消息在机器恢复之前不可订阅,消息实时性会受到受到影响。
+
+##### 1)启动NameServer
+
+NameServer需要先于Broker启动,生产环境 
需要启动多个保证高可用,一般规模的集群启动3个NameServer即可,各节点的启动命令相同,命令如下:
+
+```bash
+### 首先启动Name Server,例如机器IP为:192.161.1:9876
+$ nohup sh mqnamesrv &
+ 
+### 验证Name Server 是否启动成功
+$ tail -f ~/logs/rocketmqlogs/namesrv.log
+The Name Server boot success...
+```
+
+##### 2)启动Broker集群
+
+```bash
+### 在机器A,启动第一个Master
+$ nohup sh mqbroker -n 192.161.1:9876 -c 
$ROCKETMQ_HOME/conf/2m-noslave/broker-a.properties &
+ 
+### 在机器B,启动第二个Master
+$ nohup sh mqbroker -n 192.161.1:9876 -c 
$ROCKETMQ_HOME/conf/2m-noslave/broker-b.properties &
+
+...
+```
+
+如上启动命令是在单个NameServer情况下使用的。对于多个NameServer的集群,Broker启动命令中 -n后面的地址列表用分号隔开即可,例如 
192.161.1:9876;192.161.2:9876。
+
+#### 1.3 多Master多Slave模式-异步复制
+
+每个Master配置一个Slave,有多对Master-Slave,HA采用异步复制方式,主备有短暂消息延迟,毫秒级,这种模式的优缺点如下:
+
+- 
优点:即使磁盘损坏,消息丢失的非常少,且消息实时性不会受影响,因为Master宕机后,消费者仍然可以从Slave消费,此过程对应用透明。不需要人工干预。性能同多Master模式几乎一样;
+
+- 缺点:Master宕机,磁盘损坏情况,会丢失少量消息。
+
+##### 1)启动NameServer
+
+```bash
+### 首先启动Name Server,例如机器IP为:192.161.1:9876
+$ nohup sh mqnamesrv &
+ 
+### 验证Name Server 是否启动成功
+$ tail -f ~/logs/rocketmqlogs/namesrv.log
+The Name Server boot success...
+```
+
+##### 2)启动Broker集群
+
+```bash
+### 在机器A,启动第一个Master
+$ nohup sh mqbroker -n 192.161.1:9876 -c 
$ROCKETMQ_HOME/conf/2m-2s-async/broker-a.properties &
+ 
+### 在机器B,启动第二个Master
+$ nohup sh mqbroker -n 192.161.1:9876 -c 
$ROCKETMQ_HOME/conf/2m-2s-async/broker-b.properties &
+ 
+### 在机器C,启动第一个Slave
+$ nohup sh mqbroker -n 192.161.1:9876 -c 
$ROCKETMQ_HOME/conf/2m-2s-async/broker-a-s.properties &
+ 
+### 在机器D,启动第二个Slave
+$ nohup sh mqbroker -n 192.161.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,例如机器IP为:192.161.1:9876
+$ nohup sh mqnamesrv &
+ 
+### 验证Name Server 是否启动成功
+$ tail -f ~/logs/rocketmqlogs/namesrv.log
+The Name Server boot success...
+```
+
+##### 2)启动Broker集群
+
+```bash
+### 在机器A,启动第一个Master
+$ nohup sh mqbroker -n 192.161.1:9876 -c 
$ROCKETMQ_HOME/conf/2m-2s-sync/broker-a.properties &
+ 
+### 在机器B,启动第二个Master
+$ nohup sh mqbroker -n 192.161.1:9876 -c 
$ROCKETMQ_HOME/conf/2m-2s-sync/broker-b.properties &
+ 
+### 在机器C,启动第一个Slave
+$ nohup sh mqbroker -n 192.161.1:9876 -c 
$ROCKETMQ_HOME/conf/2m-2s-sync/broker-a-s.properties &
+ 
+### 在机器D,启动第二个Slave
+$ nohup sh mqbroker -n 192.161.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安装目录,需要用户自己设置此环境变量。
+
+### 2 mqadmin管理工具
+
+> 注意:
+>
+> 1. 执行命令方法:`./mqadmin {command} {args}`
+> 2. 几乎所有命令都需要配置-n表示namesrv地址,格式为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或更新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'>nameserve 服务地址,格式 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'>nameserve 服务地址,格式 ip:port</td>
 
 Review comment:
   nameserve?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to