{"id":1402,"date":"2023-03-19T11:20:16","date_gmt":"2023-03-19T03:20:16","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1402"},"modified":"2023-04-28T21:09:15","modified_gmt":"2023-04-28T13:09:15","slug":"rocketmq-cluster-deployment-method","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/19\/rocketmq-cluster-deployment-method\/","title":{"rendered":"RocketMQ\u96c6\u7fa4\u90e8\u7f72\u65b9\u5f0f"},"content":{"rendered":"<h2>RocketMQ\u7f51\u7edc\u90e8\u7f72\u56fe<\/h2>\n<h3>RocketMQ\u7f51\u7edc\u90e8\u7f72\u56fe<\/h3>\n<p>RocketMQ\u7f51\u7edc\u90e8\u7f72\u56fe\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><!-- more --><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/\u8fd0\u7ef4\/RocketMQ\u7f51\u7edc\u90e8\u7f72\u56fe.jpg\" alt=\"RocketMQ\u7f51\u7edc\u90e8\u7f72\u56fe\" \/><\/p>\n<h3>RocketMQ\u7f51\u7edc\u90e8\u7f72\u7279\u70b9<\/h3>\n<ul>\n<li><code>NameServer<\/code>\u662f\u4e00\u4e2a\u51e0\u4e4e\u65e0\u72b6\u6001\u8282\u70b9\uff0c\u53ef\u96c6\u7fa4\u90e8\u7f72\uff0c\u8282\u70b9\u4e4b\u95f4\u65e0\u4efb\u4f55\u4fe1\u606f\u540c\u6b65\u3002<\/li>\n<li><code>Broker<\/code>\u90e8\u7f72\u76f8\u5bf9\u590d\u6742\uff0c<code>Broker<\/code>\u5206\u4e3a<code>Master<\/code>\u4e0e<code>Slave<\/code>\uff0c\u4e00\u4e2a<code>Master<\/code>\u53ef\u4ee5\u5bf9\u5e94\u591a\u4e2a<code>Slave<\/code>\uff0c\u4f46\u662f\u4e00\u4e2a<code>Slave<\/code>\u53ea\u80fd\u5bf9\u5e94\u4e00\u4e2a<code>Master<\/code>\uff0c<code>Master<\/code>\u4e0e<code>Slave<\/code>\u7684\u5bf9\u5e94\u5173\u7cfb\u901a\u8fc7\u6307\u5b9a\u76f8\u540c\u7684<code>BrokerName<\/code>\uff0c\u4e0d\u540c\u7684<code>BrokerId<\/code>\u6765\u5b9a\u4e49\uff0c<code>BrokerId<\/code>\u4e3a<code>0<\/code>\u8868\u793a<code>Master<\/code>\uff0c\u975e<code>0<\/code>\u8868\u793a<code>Slave<\/code>\u3002<code>Master<\/code>\u4e5f\u53ef\u4ee5\u90e8\u7f72\u591a\u4e2a\u3002\u6bcf\u4e2a<code>Broker<\/code>\u4e0e<code>NameServer<\/code>\u96c6\u7fa4\u4e2d\u7684\u6240\u6709\u8282\u70b9\u5efa\u7acb\u957f\u8fde\u63a5\uff0c\u5b9a\u65f6\u6ce8\u518c<code>Topic<\/code>\u4fe1\u606f\u5230\u6240\u6709<code>NameServer<\/code>\u3002<\/li>\n<li><code>Producer<\/code>\u4e0e<code>NameServer<\/code>\u96c6\u7fa4\u4e2d\u7684\u5176\u4e2d\u4e00\u4e2a\u8282\u70b9\uff08\u968f\u673a\u9009\u62e9\uff09\u5efa\u7acb\u957f\u8fde\u63a5\uff0c\u5b9a\u671f\u4ece<code>Name Server<\/code>\u53d6<code>Topic<\/code>\u8def\u7531\u4fe1\u606f\uff0c\u5e76\u5411\u63d0\u4f9b<code>Topic<\/code>\u670d\u52a1\u7684<code>Master<\/code>\u5efa\u7acb\u957f\u8fde\u63a5\uff0c\u4e14\u5b9a\u65f6\u5411<code>Master<\/code>\u53d1\u9001\u5fc3\u8df3\u3002<code>Producer<\/code>\u5b8c\u5168\u65e0\u72b6\u6001\uff0c\u53ef\u96c6\u7fa4\u90e8\u7f72\u3002<\/li>\n<li><code>Consumer<\/code>\u4e0e<code>NameServer<\/code>\u96c6\u7fa4\u4e2d\u7684\u5176\u4e2d\u4e00\u4e2a\u8282\u70b9\uff08\u968f\u673a\u9009\u62e9\uff09\u5efa\u7acb\u957f\u8fde\u63a5\uff0c\u5b9a\u671f\u4ece<code>Name Server<\/code>\u53d6<code>Topic<\/code>\u8def\u7531\u4fe1\u606f\uff0c\u5e76\u5411\u63d0\u4f9b<code>Topic<\/code>\u670d\u52a1\u7684<code>Master<\/code>\u3001<code>Slave<\/code>\u5efa\u7acb\u957f\u8fde\u63a5\uff0c\u4e14\u5b9a\u65f6\u5411<code>Master<\/code>\u3001<code>Slave<\/code>\u53d1\u9001\u5fc3\u8df3\u3002<code>Consumer<\/code>\u65e2\u53ef\u4ee5\u4ece<code>Master<\/code>\u8ba2\u9605\u6d88\u606f\uff0c\u4e5f\u53ef\u4ee5\u4ece<code>Slave<\/code>\u8ba2\u9605\u6d88\u606f\uff0c\u8ba2\u9605\u89c4\u5219\u7531<code>Broker<\/code>\u914d\u7f6e\u51b3\u5b9a\u3002<\/li>\n<\/ul>\n<h2>NameServer\u96c6\u7fa4<\/h2>\n<p>NameServer\u96c6\u7fa4\u5982\u4e0b\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">NameServer\u96c6\u7fa4<\/th>\n<th style=\"text-align: left;\">IP\u5730\u5740<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">NameServer-1<\/td>\n<td style=\"text-align: left;\">192.168.1.101<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">NameServer-2<\/td>\n<td style=\"text-align: left;\">192.168.1.102<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5206\u522b\u542f\u52a8<\/p>\n<pre><code># nohup sh bin\/mqnamesrv &amp;\n# tail -f ~\/logs\/rocketmqlogs\/namesrv.log\nThe Name Server boot success...<\/code><\/pre>\n<h2>RocketMQ\u914d\u7f6e\u6587\u4ef6<\/h2>\n<p>\u4f17\u6240\u5468\u77e5\uff0cRocketMQ\u6709\u591a\u79cd\u96c6\u7fa4\u90e8\u7f72\u65b9\u5f0f\uff0c\u5b83\u4eec\u7684\u914d\u7f6e\u6587\u4ef6\u4e5f\u662f\u5206\u5f00\u7684\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre><code># ls -rlt \/usr\/local\/apache-rocketmq\/conf\ntotal 36\n-rw-r--r-- 1 root root  3761 Jan 14 07:18 logback_tools.xml\n-rw-r--r-- 1 root root  3836 Jan 14 07:18 logback_namesrv.xml\n-rw-r--r-- 1 root root 14978 Jan 14 07:18 logback_broker.xml\n-rw-r--r-- 1 root root   949 Jan 14 07:18 broker.conf\ndrwxr-xr-x 2 root root   118 Jan 14 07:18 2m-2s-sync\ndrwxr-xr-x 2 root root   118 Jan 14 07:18 2m-2s-async\n-rw-r--r-- 1 root root   833 Jan 14 08:24 tools.yml\ndrwxr-xr-x 2 root root    91 Jan 14 08:24 2m-noslave\n-rw-r--r-- 1 root root  1277 Jan 17 11:20 plain_acl.yml<\/code><\/pre>\n<p>\u8bf4\u660e\uff1a<\/p>\n<p><code>2m-noslave<\/code>\uff1a\u591aMaster\u6a21\u5f0f<br \/>\n<code>2m-2s-sync<\/code>\uff1a\u591aMaster\u591aSlave\u6a21\u5f0f\uff0c\u540c\u6b65\u53cc\u5199<br \/>\n<code>2m-2s-async<\/code>\uff1a\u591aMaster\u591aSlave\u6a21\u5f0f\uff0c\u5f02\u6b65\u590d\u5236<\/p>\n<p>RocketMQ\u9ed8\u8ba4\u63d0\u4f9b\u7684\u914d\u7f6e\u6587\u4ef6\u90fd\u662f\u6700\u57fa\u672c\u7684\uff0c\u5f88\u591a\u914d\u7f6e\u90fd\u662f\u9ed8\u8ba4\u503c\uff0c\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u6211\u4eec\u9700\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8fdb\u884c\u4fee\u6539\u3002\u6837\u4f8b\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n<pre><code>#\u6240\u5c5e\u96c6\u7fa4\u540d\u5b57\nbrokerClusterName=rocketmq-cluster\n#broker\u540d\u5b57\uff0c\u6ce8\u610f\u6b64\u5904\u4e0d\u540c\u7684\u914d\u7f6e\u6587\u4ef6\u586b\u5199\u7684\u4e0d\u4e00\u6837\nbrokerName=broker-a|broker-b\n#0\u8868\u793aMaster\uff0c&gt;0\u8868\u793aSlave\nbrokerId=0\n#nameServer\u5730\u5740\uff0c\u5206\u53f7\u5206\u5272\nnamesrvAddr=192.168.1.101:9876;192.168.1.102:9876\n#\u5728\u53d1\u9001\u6d88\u606f\u65f6\uff0c\u81ea\u52a8\u521b\u5efa\u670d\u52a1\u5668\u4e0d\u5b58\u5728\u7684topic\uff0c\u9ed8\u8ba4\u521b\u5efa\u7684\u961f\u5217\u6570\ndefaultTopicQueueNums=4\n#\u662f\u5426\u5141\u8bb8 Broker \u81ea\u52a8\u521b\u5efaTopic\uff0c\u5efa\u8bae\u7ebf\u4e0b\u5f00\u542f\uff0c\u7ebf\u4e0a\u5173\u95ed\nautoCreateTopicEnable=true\n#\u662f\u5426\u5141\u8bb8 Broker \u81ea\u52a8\u521b\u5efa\u8ba2\u9605\u7ec4\uff0c\u5efa\u8bae\u7ebf\u4e0b\u5f00\u542f\uff0c\u7ebf\u4e0a\u5173\u95ed\nautoCreateSubscriptionGroup=true\n#Broker \u5bf9\u5916\u670d\u52a1\u7684\u76d1\u542c\u7aef\u53e3\nlistenPort=10911\n#\u5220\u9664\u6587\u4ef6\u65f6\u95f4\u70b9\uff0c\u9ed8\u8ba4\u51cc\u6668 4\u70b9\ndeleteWhen=04\n#\u6587\u4ef6\u4fdd\u7559\u65f6\u95f4\uff0c\u9ed8\u8ba4 48 \u5c0f\u65f6\nfileReservedTime=120\n#commitLog\u6bcf\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u9ed8\u8ba41G\nmapedFileSizeCommitLog=1073741824\n#ConsumeQueue\u6bcf\u4e2a\u6587\u4ef6\u9ed8\u8ba4\u5b5830W\u6761\uff0c\u6839\u636e\u4e1a\u52a1\u60c5\u51b5\u8c03\u6574\nmapedFileSizeConsumeQueue=300000\n#destroyMapedFileIntervalForcibly=120000\n#redeleteHangedFileInterval=120000\n#\u68c0\u6d4b\u7269\u7406\u6587\u4ef6\u78c1\u76d8\u7a7a\u95f4\ndiskMaxUsedSpaceRatio=88\n#\u5b58\u50a8\u8def\u5f84\nstorePathRootDir=\/usr\/local\/alibaba-rocketmq\/store\n#commitLog \u5b58\u50a8\u8def\u5f84\nstorePathCommitLog=\/usr\/local\/alibaba-rocketmq\/store\/commitlog\n#\u6d88\u8d39\u961f\u5217\u5b58\u50a8\u8def\u5f84\u5b58\u50a8\u8def\u5f84\nstorePathConsumeQueue=\/usr\/local\/alibaba-rocketmq\/store\/consumequeue\n#\u6d88\u606f\u7d22\u5f15\u5b58\u50a8\u8def\u5f84\nstorePathIndex=\/usr\/local\/alibaba-rocketmq\/store\/index\n#checkpoint \u6587\u4ef6\u5b58\u50a8\u8def\u5f84\nstoreCheckpoint=\/usr\/local\/alibaba-rocketmq\/store\/checkpoint\n#abort \u6587\u4ef6\u5b58\u50a8\u8def\u5f84\nabortFile=\/usr\/local\/alibaba-rocketmq\/store\/abort\n#\u9650\u5236\u7684\u6d88\u606f\u5927\u5c0f\nmaxMessageSize=65536\n#flushCommitLogLeastPages=4\n#flushConsumeQueueLeastPages=2\n#flushCommitLogThoroughInterval=10000\n#flushConsumeQueueThoroughInterval=60000\n#Broker \u7684\u89d2\u8272\n#- ASYNC_MASTER \u5f02\u6b65\u590d\u5236Master\n#- SYNC_MASTER \u540c\u6b65\u53cc\u5199Master\n#- SLAVE\nbrokerRole=ASYNC_MASTER\n#\u5237\u76d8\u65b9\u5f0f\n#- ASYNC_FLUSH \u5f02\u6b65\u5237\u76d8\n#- SYNC_FLUSH \u540c\u6b65\u5237\u76d8\nflushDiskType=ASYNC_FLUSH\n#checkTransactionMessageEnable=false\n#\u53d1\u6d88\u606f\u7ebf\u7a0b\u6c60\u6570\u91cf\n#sendMessageThreadPoolNums=128\n#\u62c9\u6d88\u606f\u7ebf\u7a0b\u6c60\u6570\u91cf\n#pullMessageThreadPoolNums=128<\/code><\/pre>\n<h2>Broker\u96c6\u7fa4\u90e8\u7f72<\/h2>\n<p>Broker\u96c6\u7fa4\u90e8\u7f72\u6709\u51e0\u79cd\u4e0d\u540c\u7684\u65b9\u5f0f\u3002\u8fd9\u91cc\u7684Slave\u4e0d\u53ef\u5199\uff0c\u4f46\u53ef\u8bfb\uff0c\u7c7b\u4f3c\u4e8eMySQL\u7684\u4e3b\u5907\u65b9\u5f0f\u3002<\/p>\n<h3>\u5355\u4e2aMaster<\/h3>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u98ce\u9669\u8f83\u5927\uff0c\u4e00\u65e6Broker\u91cd\u542f\u6216\u8005\u5b95\u673a\u65f6\uff0c\u4f1a\u5bfc\u81f4\u6574\u4e2a\u670d\u52a1\u4e0d\u53ef\u7528\uff0c\u4e0d\u5efa\u8bae\u7ebf\u4e0a\u73af\u5883\u4f7f\u7528<\/p>\n<h3>\u591aMaster\u6a21\u5f0f<\/h3>\n<p>\u4e00\u4e2a\u96c6\u7fa4\u65e0Slave\uff0c\u5168\u662fMaster\uff0c\u4f8b\u59822\u4e2aMaster\u6216\u80053\u4e2aMaster\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">brokerName<\/th>\n<th style=\"text-align: left;\">brokerId<\/th>\n<th style=\"text-align: left;\">brokerRole<\/th>\n<th style=\"text-align: left;\">IP\u5730\u5740<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">broker-a<\/td>\n<td style=\"text-align: left;\">0<\/td>\n<td style=\"text-align: left;\">ASYNC_MASTER<\/td>\n<td style=\"text-align: left;\">192.168.1.101<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">broker-b<\/td>\n<td style=\"text-align: left;\">0<\/td>\n<td style=\"text-align: left;\">ASYNC_MASTER<\/td>\n<td style=\"text-align: left;\">192.168.1.102<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p>\u4f18\u70b9\uff1a\u914d\u7f6e\u7b80\u5355\uff0c\u5355\u4e2aMaster\u5b95\u673a\u6216\u91cd\u542f\u7ef4\u62a4\u5bf9\u5e94\u7528\u65e0\u5f71\u54cd\uff0c\u5728\u78c1\u76d8\u914d\u7f6e\u4e3aRAID10\u65f6\uff0c\u5373\u4f7f\u673a\u5668\u5b95\u673a\u4e0d\u53ef\u6062\u590d\u60c5\u51b5\u4e0b\uff0c\u7531\u4e8eRAID10\u78c1\u76d8\u975e\u5e38\u53ef\u9760\uff0c\u6d88\u606f\u4e5f\u4e0d\u4f1a\u4e22\u5931\uff08\u5f02\u6b65\u5237\u76d8\u4e22\u5931\u5c11\u91cf\u6d88\u606f\uff0c\u540c\u6b65\u5237\u76d8\u4e00\u6761\u4e0d\u4e22\uff09\u3002\u6027\u80fd\u6700\u9ad8\u3002<\/p>\n<p>\u7f3a\u70b9\uff1a\u5355\u53f0\u673a\u5668\u5b95\u673a\u671f\u95f4\uff0c\u8fd9\u53f0\u673a\u5668\u4e0a\u672a\u88ab\u6d88\u8d39\u7684\u6d88\u606f\u5728\u673a\u5668\u6062\u590d\u4e4b\u524d\u4e0d\u53ef\u8ba2\u9605\uff0c\u6d88\u606f\u5b9e\u65f6\u6027\u4f1a\u53d7\u5230\u5f71\u54cd\u3002<\/p>\n<\/blockquote>\n<p>\u542f\u52a8\u6b65\u9aa4\uff1a<\/p>\n<p>\uff081\uff09\u542f\u52a8NameServer\u96c6\u7fa4<\/p>\n<p>\uff082\uff09\u5728192.168.1.101\uff0c\u542f\u52a8\u7b2c\u4e00\u4e2aMaster<\/p>\n<pre><code># nohup sh bin\/mqbroker -c conf\/2m-noslave\/broker-a.properties autoCreateTopicEnable=true &amp;\n# tail -f logs\/rocketmqlogs\/broker.log\nThe broker[%s, 192.168.1.101] boot success...<\/code><\/pre>\n<p>\u914d\u7f6e\u6587\u4ef6<code>conf\/2m-noslave\/broker-a.properties<\/code><\/p>\n<pre><code>brokerClusterName=DefaultCluster\nbrokerName=broker-a\nbrokerId=0\nnamesrvAddr=192.168.1.101:9876;192.168.1.102:9876\ndeleteWhen=04\nfileReservedTime=48\nbrokerRole=ASYNC_MASTER\nflushDiskType=ASYNC_FLUSH<\/code><\/pre>\n<p>Broker\u542f\u52a8\u72b6\u6001<\/p>\n<pre><code># sh bin\/mqadmin clusterList -n localhost:9876\nJava HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0\nJava HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0\n#Cluster Name     #Broker Name            #BID  #Addr                  #Version                #InTPS(LOAD)       #OutTPS(LOAD) #PCWait(ms) #Hour #SPACE\nDefaultCluster    broker-a                0     192.168.1.101:10911    V4_4_0                   0.00(0,0ms)         0.00(0,0ms)          0 433638.17 0.0202\nDefaultCluster    broker-b                0     192.168.1.102:10911    V4_4_0                   0.00(0,0ms)         0.00(0,0ms)          0 433638.17 0.0169<\/code><\/pre>\n<p>\uff083\uff09\u5728192.168.1.102\uff0c\u542f\u52a8\u7b2c\u4e8c\u4e2aMaster<\/p>\n<pre><code># mkdir logs\n# nohup sh bin\/mqbroker -c conf\/2m-noslave\/broker-b.properties autoCreateTopicEnable=true &gt;logs\/broker.log 2&gt;&amp;1 &amp;\n# tail -f logs\/broker.log\nThe broker[%s, 192.168.1.102] boot success...<\/code><\/pre>\n<p>\u914d\u7f6e\u6587\u4ef6<code>conf\/2m-noslave\/broker-b.properties<\/code><\/p>\n<pre><code>brokerClusterName=DefaultCluster\nbrokerName=broker-b\nbrokerId=0\nnamesrvAddr=192.168.1.101:9876;192.168.1.102:9876\ndeleteWhen=04\nfileReservedTime=48\nbrokerRole=ASYNC_MASTER\nflushDiskType=ASYNC_FLUSH<\/code><\/pre>\n<p>Broker\u542f\u52a8\u72b6\u6001<\/p>\n<pre><code># sh bin\/mqadmin clusterList -n localhost:9876\nJava HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0\nJava HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0\n#Cluster Name     #Broker Name            #BID  #Addr                  #Version                #InTPS(LOAD)       #OutTPS(LOAD) #PCWait(ms) #Hour #SPACE\nDefaultCluster    broker-a                0     192.168.1.101:10911    V4_4_0                   0.00(0,0ms)         0.00(0,0ms)          0 433638.26 0.0202\nDefaultCluster    broker-b                0     192.168.1.102:10911    V4_4_0                   0.00(0,0ms)         0.00(0,0ms)          0 433638.26 0.0170<\/code><\/pre>\n<h3>\u591aMaster\u591aSlave\u6a21\u5f0f\uff0c\u5f02\u6b65\u590d\u5236<\/h3>\n<p>\u6bcf\u4e2aMaster\u914d\u7f6e\u4e00\u4e2aSlave\uff0c\u6709\u591a\u5bf9Master-Slave\uff0cHA\u91c7\u7528\u5f02\u6b65\u590d\u5236\u65b9\u5f0f\uff0c\u4e3b\u5907\u6709\u77ed\u6682\u6d88\u606f\u5ef6\u8fdf\uff0c\u6beb\u79d2\u7ea7\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">brokerName<\/th>\n<th style=\"text-align: left;\">brokerId<\/th>\n<th style=\"text-align: left;\">brokerRole<\/th>\n<th style=\"text-align: left;\">IP\u5730\u5740<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">broker-a<\/td>\n<td style=\"text-align: left;\">0<\/td>\n<td style=\"text-align: left;\">ASYNC_MASTER<\/td>\n<td style=\"text-align: left;\">192.168.1.101<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">broker-a<\/td>\n<td style=\"text-align: left;\">1<\/td>\n<td style=\"text-align: left;\">SLAVE<\/td>\n<td style=\"text-align: left;\">192.168.1.102<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">broker-b<\/td>\n<td style=\"text-align: left;\">0<\/td>\n<td style=\"text-align: left;\">ASYNC_MASTER<\/td>\n<td style=\"text-align: left;\">192.168.1.103<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">broker-b<\/td>\n<td style=\"text-align: left;\">1<\/td>\n<td style=\"text-align: left;\">SLAVE<\/td>\n<td style=\"text-align: left;\">192.168.1.104<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p>\u4f18\u70b9\uff1a\u5373\u4f7f\u78c1\u76d8\u635f\u574f\uff0c\u6d88\u606f\u4e22\u5931\u7684\u975e\u5e38\u5c11\uff0c\u4e14\u6d88\u606f\u5b9e\u65f6\u6027\u4e0d\u4f1a\u53d7\u5f71\u54cd\uff0c\u56e0\u4e3aMaster \u5b95\u673a\u540e\uff0c\u6d88\u8d39\u8005\u4ecd\u7136\u53ef\u4ee5\u4eceSlave\u6d88\u8d39\uff0c\u6b64\u8fc7\u7a0b\u5bf9\u5e94\u7528\u900f\u660e\u3002\u4e0d\u9700\u8981\u4eba\u5de5\u5e72\u9884\u3002\u6027\u80fd\u540c\u591a Master \u6a21\u5f0f\u51e0\u4e4e\u4e00\u6837\u3002<\/p>\n<p>\u7f3a\u70b9\uff1aMaster\u5b95\u673a\uff0c\u78c1\u76d8\u635f\u574f\u60c5\u51b5\uff0c\u4f1a\u4e22\u5931\u5c11\u91cf\u6d88\u606f\u3002<\/p>\n<\/blockquote>\n<p>\u542f\u52a8\u6b65\u9aa4\uff1a<\/p>\n<p>\uff081\uff09\u542f\u52a8NameServer\u96c6\u7fa4<\/p>\n<p>\uff082\uff09\u5728192.168.1.101\uff0c\u542f\u52a8\u7b2c\u4e00\u4e2aMaster<\/p>\n<pre><code># mkdir logs\n# nohup sh bin\/mqbroker -n localhost:9876 -c conf\/2m-2s-async\/broker-a.properties &gt;logs\/broker.log 2&gt;&amp;1 &amp;\n# tail -f logs\/broker.log<\/code><\/pre>\n<p>\uff083\uff09\u5728192.168.1.102\uff0c\u542f\u52a8\u7b2c\u4e00\u4e2aSlave<\/p>\n<pre><code># mkdir logs\n# nohup sh bin\/mqbroker -n localhost:9876 -c conf\/2m-2s-async\/broker-a-s.properties &gt;logs\/broker.log 2&gt;&amp;1 &amp;\n# tail -f logs\/broker.log<\/code><\/pre>\n<p>\uff084\uff09\u5728192.168.1.103\uff0c\u542f\u52a8\u7b2c\u4e8c\u4e2aMaster<\/p>\n<pre><code># mkdir logs\n# nohup sh bin\/mqbroker -n localhost:9876 -c conf\/2m-2s-async\/broker-b.properties &gt;logs\/broker.log 2&gt;&amp;1 &amp;\n# tail -f logs\/broker.log<\/code><\/pre>\n<p>\uff085\uff09\u5728192.168.1.104\uff0c\u542f\u52a8\u7b2c\u4e8c\u4e2aSlave<\/p>\n<pre><code># mkdir logs\n# nohup sh bin\/mqbroker -n localhost:9876 -c conf\/2m-2s-async\/broker-b-s.properties &gt;logs\/broker.log 2&gt;&amp;1 &amp;\n# tail -f logs\/broker.log<\/code><\/pre>\n<h3>\u591aMaster\u591aSlave\u6a21\u5f0f\uff0c\u540c\u6b65\u53cc\u5199<\/h3>\n<p>\u6bcf\u4e2aMaster\u914d\u7f6e\u4e00\u4e2aSlave\uff0c\u6709\u591a\u5bf9Master-Slave\uff0cHA\u91c7\u7528\u540c\u6b65\u53cc\u5199\u65b9\u5f0f\uff0c\u4e3b\u5907\u90fd\u5199\u6210\u529f\uff0c\u5411\u5e94\u7528\u624d\u8fd4\u56de\u6210\u529f\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">brokerName<\/th>\n<th style=\"text-align: left;\">brokerId<\/th>\n<th style=\"text-align: left;\">brokerRole<\/th>\n<th style=\"text-align: left;\">IP\u5730\u5740<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">broker-a<\/td>\n<td style=\"text-align: left;\">0<\/td>\n<td style=\"text-align: left;\">SYNC_MASTER<\/td>\n<td style=\"text-align: left;\">192.168.1.101<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">broker-a<\/td>\n<td style=\"text-align: left;\">1<\/td>\n<td style=\"text-align: left;\">SLAVE<\/td>\n<td style=\"text-align: left;\">192.168.1.102<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">broker-b<\/td>\n<td style=\"text-align: left;\">0<\/td>\n<td style=\"text-align: left;\">SYNC_MASTER<\/td>\n<td style=\"text-align: left;\">192.168.1.103<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">broker-b<\/td>\n<td style=\"text-align: left;\">1<\/td>\n<td style=\"text-align: left;\">SLAVE<\/td>\n<td style=\"text-align: left;\">192.168.1.104<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p>\u4f18\u70b9\uff1a\u6570\u636e\u4e0e\u670d\u52a1\u90fd\u65e0\u5355\u70b9\uff0cMaster\u5b95\u673a\u60c5\u51b5\u4e0b\uff0c\u6d88\u606f\u65e0\u5ef6\u8fdf\uff0c\u670d\u52a1\u53ef\u7528\u6027\u4e0e\u6570\u636e\u53ef\u7528\u6027\u90fd\u975e\u5e38\u9ad8\u3002<\/p>\n<p>\u7f3a\u70b9\uff1a\u6027\u80fd\u6bd4\u5f02\u6b65\u590d\u5236\u6a21\u5f0f\u7565\u4f4e\uff0c\u5927\u7ea6\u4f4e10%\u5de6\u53f3\uff0c\u53d1\u9001\u5355\u4e2a\u6d88\u606f\u7684RT\u4f1a\u7565\u9ad8\u3002\u76ee\u524d\u4e3b\u5b95\u673a\u540e\uff0c\u5907\u673a\u4e0d\u80fd\u81ea\u52a8\u5207\u6362\u4e3a\u4e3b\u673a\uff0c\u540e\u7eed\u4f1a\u652f\u6301\u81ea\u52a8\u5207\u6362\u529f\u80fd\u3002<\/p>\n<\/blockquote>\n<p>\u542f\u52a8\u6b65\u9aa4\uff1a<\/p>\n<p>\uff081\uff09\u542f\u52a8NameServer\u96c6\u7fa4<\/p>\n<p>\uff082\uff09\u5728192.168.1.101\uff0c\u542f\u52a8\u7b2c\u4e00\u4e2aMaster<\/p>\n<pre><code># mkdir logs\n# nohup sh bin\/mqbroker -n localhost:9876 -c conf\/2m-2s-sync\/broker-a.properties &gt;logs\/broker.log 2&gt;&amp;1 &amp;\n# tail -f logs\/broker.log<\/code><\/pre>\n<p>\uff083\uff09\u5728192.168.1.102\uff0c\u542f\u52a8\u7b2c\u4e00\u4e2aSlave<\/p>\n<pre><code># mkdir logs\n# nohup sh bin\/mqbroker -n localhost:9876 -c conf\/2m-2s-sync\/broker-a-s.properties &gt;logs\/broker.log 2&gt;&amp;1 &amp;\n# tail -f logs\/broker.log<\/code><\/pre>\n<p>\uff084\uff09\u5728192.168.1.103\uff0c\u542f\u52a8\u7b2c\u4e8c\u4e2aMaster<\/p>\n<pre><code># mkdir logs\n# nohup sh bin\/mqbroker -n localhost:9876 -c conf\/2m-2s-sync\/broker-b.properties &gt;logs\/broker.log 2&gt;&amp;1 &amp;\n# tail -f logs\/broker.log<\/code><\/pre>\n<p>\uff085\uff09\u5728192.168.1.104\uff0c\u542f\u52a8\u7b2c\u4e8c\u4e2aSlave<\/p>\n<pre><code># mkdir logs\n# nohup sh bin\/mqbroker -n localhost:9876 -c conf\/2m-2s-sync\/broker-b-s.properties &gt;logs\/broker.log 2&gt;&amp;1 &amp;\n# tail -f logs\/broker.log<\/code><\/pre>\n<blockquote>\n<p>\u6ce8\u610f\u4e8b\u9879\uff1a\u4ee5\u4e0aBroker\u4e0eSlave\u914d\u5bf9\u662f\u901a\u8fc7\u6307\u5b9a\u76f8\u540c\u7684<code>brokerName<\/code>\u53c2\u6570\u6765\u914d\u5bf9\uff0cMaster\u7684 <code>BrokerId<\/code>\u5fc5\u987b\u662f0\uff0cSlave\u7684<code>BrokerId<\/code>\u5fc5\u987b\u662f\u5927\u4e8e0\u7684\u6570\u3002\u53e6\u5916\u4e00\u4e2aMaster\u4e0b\u9762\u53ef\u4ee5\u6302\u8f7d\u591a\u4e2aSlave\uff0c\u540c\u4e00Master\u4e0b\u7684\u591a\u4e2aSlave\u901a\u8fc7\u6307\u5b9a\u4e0d\u540c\u7684BrokerId\u6765\u533a\u5206\u3002<\/p>\n<\/blockquote>\n<h2>\u603b\u7ed3<\/h2>\n<h3>\u5f02\u6b65\u590d\u5236\u548c\u540c\u6b65\u53cc\u5199\u603b\u7ed3<\/h3>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/\u8fd0\u7ef4\/RocketMQ\u5f02\u6b65\u590d\u5236\u548c\u540c\u6b65\u53cc\u5199\u5bf9\u6bd4.jpg\" alt=\"RocketMQ\u5f02\u6b65\u590d\u5236\u548c\u540c\u6b65\u53cc\u5199\u5bf9\u6bd4\" \/><\/p>\n<h3>\u96c6\u7fa4\u65b9\u5f0f\u5bf9\u6bd4<\/h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">\u96c6\u7fa4\u65b9\u5f0f<\/th>\n<th style=\"text-align: left;\">\u8fd0\u7ef4\u7279\u70b9<\/th>\n<th style=\"text-align: left;\">\u6d88\u606f\u53ef\u9760\u6027<br \/>(master\u5b95\u673a\u60c5\u51b5)<\/th>\n<th style=\"text-align: left;\">\u670d\u52a1\u53ef\u7528\u6027<br \/>(master\u5b95\u673a\u60c5\u51b5)<\/th>\n<th style=\"text-align: left;\">\u5176\u4ed6\u7279\u70b9<\/th>\n<th style=\"text-align: left;\">\u5907\u6ce8<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">\u5355Master<\/td>\n<td style=\"text-align: left;\">\u7ed3\u6784\u7b80\u5355\uff0c\u6269\u5bb9\u65b9\u4fbf\uff0c\u673a\u5668\u8981\u6c42\u4f4e<\/td>\n<td style=\"text-align: left;\">\u540c\u6b65\u5237\u76d8\u6d88\u606f\u4e00\u6761\u90fd\u4e0d\u4f1a\u4e22<\/td>\n<td style=\"text-align: left;\">\u6574\u4f53\u53ef\u7528\uff0c\u672a\u88ab\u6d88\u8d39\u7684\u6d88\u606f\u65e0\u6cd5\u53d6\u5f97\uff0c\u5f71\u54cd\u5b9e\u65f6\u6027<\/td>\n<td style=\"text-align: left;\">\u6027\u80fd\u6700\u9ad8<\/td>\n<td style=\"text-align: left;\"><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u591aMaster<\/td>\n<td style=\"text-align: left;\"><\/td>\n<td style=\"text-align: left;\">\u5f02\u6b65\u6709\u6beb\u79d2\u7ea7\u4e22\u5931\uff0c\u540c\u6b65\u53cc\u5199\u4e0d\u4e22\u5931<\/td>\n<td style=\"text-align: left;\">\u5dee\u8bc4\uff0c\u4e3b\u5907\u4e0d\u80fd\u81ea\u52a8\u5207\u6362\uff0c\u4e14\u5907\u673a\u53ea\u80fd\u8bfb\u4e0d\u80fd\u5199\uff0c\u4f1a\u9020\u6210\u670d\u52a1\u6574\u4f53\u4e0d\u53ef\u5199<\/td>\n<td style=\"text-align: left;\"><\/td>\n<td style=\"text-align: left;\">\u4e0d\u8003\u8651\uff0c\u9664\u975e\u81ea\u5df1\u63d0\u4f9b\u4e3b\u4ece\u5207\u6362\u7684\u65b9\u6848<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Master-Slave(\u5f02\u6b65\u590d\u5236)<\/td>\n<td style=\"text-align: left;\">\u7ed3\u6784\u590d\u6742\uff0c\u6269\u5bb9\u65b9\u4fbf<\/td>\n<td style=\"text-align: left;\">\u6545\u969c\u65f6\u4f1a\u4e22\u5931\u6d88\u606f<\/td>\n<td style=\"text-align: left;\">\u6574\u4f53\u53ef\u7528\uff0c\u5b9e\u65f6\u6027\u5f71\u54cd\u6beb\u79d2\u7ea7\u522b\uff0c\u8be5\u7ec4\u670d\u52a1\u53ea\u80fd\u8bfb\u4e0d\u80fd\u5199<\/td>\n<td style=\"text-align: left;\">\u6027\u80fd\u5f88\u9ad8<\/td>\n<td style=\"text-align: left;\">\u9002\u5408\u6d88\u606f\u53ef\u9760\u6027\u4e2d\u7b49\uff0c\u5b9e\u65f6\u6027\u4e2d\u7b49\u7684\u8981\u6c42<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Master-Slave(\u540c\u6b65\u53cc\u5199)<\/td>\n<td style=\"text-align: left;\">\u7ed3\u6784\u590d\u6742\uff0c\u6269\u5bb9\u65b9\u4fbf<\/td>\n<td style=\"text-align: left;\">\u4e0d\u4e22\u6d88\u606f<\/td>\n<td style=\"text-align: left;\">\u6574\u4f53\u53ef\u7528\uff0c\u4e0d\u5f71\u54cd\u5b9e\u65f6\u6027\uff0c\u8be5\u7ec4\u670d\u52a1\u53ea\u80fd\u8bfb\u4e0d\u80fd\u5199<\/td>\n<td style=\"text-align: left;\">\u6027\u80fd\u6bd4\u5f02\u6b65\u4f4e10%\uff0c\u6240\u4ee5\u5b9e\u65f6\u6027\u4e5f\u5e76\u4e0d\u6bd4\u5f02\u6b65\u65b9\u5f0f\u592a\u9ad8<\/td>\n<td style=\"text-align: left;\">\u9002\u5408\u6d88\u606f\u53ef\u9760\u6027\u7565\u9ad8\uff0c\u5b9e\u65f6\u6027\u4e2d\u7b49\u3001\u6027\u80fd\u8981\u6c42\u4e0d\u9ad8\u7684\u9700\u6c42<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u9ad8\u53ef\u7528\u6f14\u7ec3\u573a\u666f<\/h2>\n<p>RocketMQ\u9ad8\u53ef\u7528\u6f14\u7ec3\u573a\u666f<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">\u9879\u76ee<\/th>\n<th style=\"text-align: left;\">\u53d1\u9001\u6d88\u606f<\/th>\n<th style=\"text-align: left;\">\u53d1\u9001\u6d88\u606f\u8fc7\u7a0b\u4e2d<\/th>\n<th style=\"text-align: left;\">\u63a5\u6536\u6d88\u8d39\u6d88\u606f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">\u505c\u7528\u4e00\u4e2anamesrv<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u505c\u7528\u5168\u90e8namesrv<\/td>\n<td style=\"text-align: left;\">\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u5f71\u54cd\u901a\u4fe1\uff0c\u542f\u52a8\u4efb\u610f\u7684namesrv\u53ef\u6062\u590d<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u505c\u7528\u5355\u4e2amaster broker<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u505c\u7528\u5168\u90e8master broker<\/td>\n<td style=\"text-align: left;\">\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u5f71\u54cd\u901a\u4fe1\uff0c\u65e0\u6cd5\u6062\u590d<\/td>\n<td style=\"text-align: left;\">\u5f71\u54cd\u901a\u4fe1<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u505c\u7528\u4e00\u4e2aslave broker<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u505c\u7528\u5168\u90e8slave broker<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1<\/td>\n<td style=\"text-align: left;\">\u5f71\u54cd\u901a\u4fe1\uff0c\u6570\u79d2\u6062\u590d<\/td>\n<td style=\"text-align: left;\">\u4e0d\u5f71\u54cd\u901a\u4fe1\uff0c\u6570\u79d2\u6062\u590d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>RocketMQ\u7f51\u7edc\u90e8\u7f72\u56fe RocketMQ\u7f51\u7edc\u90e8\u7f72\u56fe RocketMQ\u7f51\u7edc\u90e8\u7f72\u56fe\u5982\u4e0b\u56fe\u6240\u793a\uff1a RocketM [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[333],"tags":[],"class_list":["post-1402","post","type-post","status-publish","format-standard","hentry","category-install-deploy"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1402"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1402\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}