RocketMQ集群搭建:从源码开始

第一部分 apache rocketmq 4.0.0-incubating 编译及2m-2s-async集群安装


第二部分 RocketMQ-Console 编译和安装


#编译

wget https://codeload.github.com/apache/incubator-rocketmq/zip/rocketmq-4.0.0-incubating

mv rocketmq-4.0.0-incubating rocketmq-4.0.0-incubating.zip

unzip rocketmq-4.0.0-incubating.zip

mv ** rocketmq

mvn clean package install -Prelease-all assembly:assembly -U -DskipTests=true

将生成的安装文件target/apache-rocketmq-all.tar.gz 解压到/root/apache-rocketmq

修改
vi runserver.sh

vi runbroker.sh

vi tool.sh
里的jvm堆栈参数,避免申请内存过大导致的oom

修改/root/apache-rocketmq/conf/2m-2s-async/下的4个文件

#将rocket目录复制到其他几台机器

scp /root/apache-rocketmq   [email protected]:/root

###########################################################################
###启动######

 安装目录 /root/apache-rocketmq/

cd /root/apache-rocketmq/bin

#两台namesrv
192 .168.1.193

nohup sh mqnamesrv &
(参考namesrv启动方式
nohup sh mqnamesrv 1 > $ROCKETMQ_HOME / log /ng. log 2 > $ROCKETMQ_HOME / log /ng- error . log & )

#nohup sh mqbroker -c /root/rocketmq4.0.0/conf/2m-2s-async/broker-c.properties >broker-c.out 2>&1 & 

192 .168.1.194
nohup sh mqnamesrv &


##2m-2s-async 集群

192 .168.1.191  配置2m-2s-async集群  

nohup sh mqbroker -c /root/apache-rocketmq/conf/2m-2s-async/broker-a.properties >broker-a.out 2>&1 &


192 .168.1.192  配置2m-2s-async集群  

nohup sh mqbroker -c /root/apache-rocketmq/conf/2m-2s-async/broker-b.properties >broker-b.out 2>&1 &



192 .168.1.189  配置2m-2s-async集群  

nohup sh mqbroker -c /root/apache-rocketmq/conf/2m-2s-async/broker-a-s.properties >broker-a-s.out 2>&1 & 



192 .168.1.194  配置2m-2s-async集群  

nohup sh mqbroker -c /root/apache-rocketmq/conf/2m-2s-async/broker-b-s.properties >broker-b-s.out 2>&1 &  



##rocket-mq console配置运行(在192.168.1.191部署)

#取代码

git clone https://github.com/apache/incubator-rocketmq-externals.git


cd /root/incubator-rocketmq-externals/rocketmq-console


#编译

mvn clean package -DskipTests=true

#运行

创建start.sh

nohup mvn spring-boot:run  -Drocketmq.namesrv.addr=192.168.1.193:9876;192.168.1.194:9876 >console.log 2>&1 &


nohup sh start.sh &

看界面


http://192.168.1.191:8080/


效果