1.压缩包准备
两台服务器镜像操作cd /optmkdir softcd soft将两个压缩包复制到 soft目录unzip apache-maven-3.2.2-bin.zipunzip rocketmq-all-4.2.0-source-release.zip2.配置环境变量配置MAVEN的PATHvim /etc/profileMAVEN_HOME=/opt/soft/apache-maven-3.2.2export MAVEN_HOMEexport PATH=${PATH}:${MAVEN_HOME}/bin配置rocketmq的PATHexport ROCKETMQ_HOME=/opt/soft/rocketmq-all-4.2.0/distribution/target/apache-rocketmq export PATH=$PATH::$ROCKETMQ_HOME/bin执行变更 source /etc/profile 3.编译cd rocketmq-all-4.2.0/mvn -Prelease-all -DskipTests clean install -Ucd distribution/target/apache-rocketmq4.启动启动 NameServernohup sh bin/mqnamesrv &tail -f ~/logs/rocketmqlogs/namesrv.log启动 Brokernohup sh bin/mqbroker -n localhost:9876 autoCreateTopicEnable=true &tail -f ~/logs/rocketmqlogs/broker.log5.配置hostvim /etc/hosts添加内容172.18.0.174 rocketmq1172.18.0.175 rocketmq26.配置主从创建目录/root/store/master/和/root/store/master/commitlog编辑master的配置文件vim /opt/soft/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/conf/2m-2s-sync/broker-a.properties 修改为brokerClusterName=tl-rocketmq-clusterbrokerName=broker-abrokerIP1=172.18.0.175brokerId=1namesrvAddr=rocketmq1:9876;rocketmq2:9876defaultTopicQueueNums=4autoCreateTopicEnable=trueautoCreateSubscriptionGroup=truelistenPort=10911deleteWhen=04fileReservedTime=120mapedFileSizeCommitLog=1073741824mapedFileSizeConsumeQueue=300000destroyMapedFileIntervalForcibly=120000redeleteHangedFileInterval=120000diskMaxUsedSpaceRatio=88storePathRootDir=/root/store/master/storePathCommitLog=/root/store/master/commitlogmaxMessageSize=65536flushCommitLogLeastPages=4flushConsumeQueueLeastPages=2flushCommitLogThoroughInterval=10000flushConsumeQueueThoroughInterval=60000checkTransactionMessageEnable=falsesendMessageThreadPoolNums=128pullMessageThreadPoolNums=128brokerRole=ASYNC_MASTERflushDiskType=ASYNC_FLUSH修改slave的配置文件
vim /opt/soft/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/conf/2m-2s-sync/broker-b-s.properties修改为brokerClusterName=tl-rocketmq-clusterbrokerName=broker-bbrokerIP1=172.18.0.175brokerId=1namesrvAddr=rocketmq1:9876;rocketmq2:9876defaultTopicQueueNums=4autoCreateTopicEnable=trueautoCreateSubscriptionGroup=truelistenPort=10921deleteWhen=04fileReservedTime=120mapedFileSizeCommitLog=1073741824mapedFileSizeConsumeQueue=300000destroyMapedFileIntervalForcibly=120000redeleteHangedFileInterval=120000diskMaxUsedSpaceRatio=88storePathRootDir=/root/store/slave/storePathCommitLog=/root/store/slave/commitlogmaxMessageSize=65536flushCommitLogLeastPages=4flushConsumeQueueLeastPages=2flushCommitLogThoroughInterval=10000flushConsumeQueueThoroughInterval=60000checkTransactionMessageEnable=falsesendMessageThreadPoolNums=128pullMessageThreadPoolNums=128brokerRole=SLAVEflushDiskType=ASYNC_FLUSH7.启动cd /opt/soft/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/bin启动 命名服务nohup sh mqnamesrv &启动 主nohup sh mqbroker -c /opt/soft/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/conf/2m-2s-sync/broker-a.properties&启动 从nohup sh mqbroker -c /opt/soft/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/conf/2m-2s-sync/broker-b-s.properties&停止sh mqshutdown brokersh mqshutdown namesrv8.后台控制rocketmq-console的安装将rocketmq-console-ng-1.0.0.jar上传到175启动rocketmq-consolenohup java -jar rocketmq-console-ng-1.0.0.jar --server.port=8080 >log.txt &访问http://172.18.0.175:8080