博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ROCKETMQ——2主2从集群部署
阅读量:6946 次
发布时间:2019-06-27

本文共 3423 字,大约阅读时间需要 11 分钟。

1.压缩包准备

两台服务器镜像操作
cd /opt
mkdir soft
cd soft
将两个压缩包复制到 soft目录
unzip apache-maven-3.2.2-bin.zip
unzip rocketmq-all-4.2.0-source-release.zip
2.配置环境变量
配置MAVEN的PATH
vim /etc/profile
MAVEN_HOME=/opt/soft/apache-maven-3.2.2
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin
配置rocketmq的PATH
export 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 -U
cd distribution/target/apache-rocketmq
4.启动
启动 NameServer
nohup sh bin/mqnamesrv &
tail -f ~/logs/rocketmqlogs/namesrv.log
启动 Broker
nohup sh bin/mqbroker -n localhost:9876 autoCreateTopicEnable=true &
tail -f ~/logs/rocketmqlogs/broker.log
5.配置host
vim /etc/hosts
添加内容
172.18.0.174 rocketmq1
172.18.0.175 rocketmq2
6.配置主从
创建目录/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-cluster
brokerName=broker-a
brokerIP1=172.18.0.175
brokerId=1
namesrvAddr=rocketmq1:9876;rocketmq2:9876
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10911
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000
destroyMapedFileIntervalForcibly=120000
redeleteHangedFileInterval=120000
diskMaxUsedSpaceRatio=88
storePathRootDir=/root/store/master/
storePathCommitLog=/root/store/master/commitlog
maxMessageSize=65536
flushCommitLogLeastPages=4
flushConsumeQueueLeastPages=2
flushCommitLogThoroughInterval=10000
flushConsumeQueueThoroughInterval=60000
checkTransactionMessageEnable=false
sendMessageThreadPoolNums=128
pullMessageThreadPoolNums=128
brokerRole=ASYNC_MASTER
flushDiskType=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-cluster
brokerName=broker-b
brokerIP1=172.18.0.175
brokerId=1
namesrvAddr=rocketmq1:9876;rocketmq2:9876
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10921
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000
destroyMapedFileIntervalForcibly=120000
redeleteHangedFileInterval=120000
diskMaxUsedSpaceRatio=88
storePathRootDir=/root/store/slave/
storePathCommitLog=/root/store/slave/commitlog
maxMessageSize=65536
flushCommitLogLeastPages=4
flushConsumeQueueLeastPages=2
flushCommitLogThoroughInterval=10000
flushConsumeQueueThoroughInterval=60000
checkTransactionMessageEnable=false
sendMessageThreadPoolNums=128
pullMessageThreadPoolNums=128
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
7.启动
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 broker
sh mqshutdown namesrv
8.后台控制rocketmq-console的安装
将rocketmq-console-ng-1.0.0.jar上传到175
启动rocketmq-console
nohup java -jar rocketmq-console-ng-1.0.0.jar --server.port=8080 >log.txt &
访问http://172.18.0.175:8080

 

转载于:https://www.cnblogs.com/laowang-tester/p/9550020.html

你可能感兴趣的文章
Rikka with Chess(规律)
查看>>
【设计模式】迭代器模式
查看>>
MATLAB中imshow()和image()
查看>>
Atitit.eclipse git使用
查看>>
JAVA逆向&反混淆-追查Burpsuite的破解原理(转)
查看>>
cocos2dx 3.1从零学习(一)——入门篇(一天学会打飞机)
查看>>
[CareerCup] 15.4 Types of Join 各种交
查看>>
文档批量格式化之word技能
查看>>
C#~异步编程再续~await与async引起的w3wp.exe崩溃
查看>>
Android屏幕适配全攻略(最权威的官方适配指导)
查看>>
.NET设计模式访问者模式
查看>>
怎么使用jquery判断一个元素是否含有一个指定的类(class)
查看>>
Servlet、Struts2、SpringMVC执行流程
查看>>
c3p0数据库连接池死锁问题
查看>>
转: 一致性哈希算法及其在分布式系统中的应用
查看>>
SVN版本冲突解决
查看>>
java多线程知识点汇总(四)多线程知识点脉络图
查看>>
nginx的upstream目前支持5种方式的分配
查看>>
android图像处理(3) 底片效果
查看>>
stl 之set图解
查看>>