码迷,mamicode.com
首页 > 其他好文 > 详细

rocketmq集群搭建

时间:2019-01-31 18:17:18      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:res   集群   style   disk   more   conf   limit   roc   perm   

1、下载rocketmq包

2、解压zip包

3、编译部署

4、配置环境变量

5、启动 NameServer(每台机器都要启动)

6、启动broker(每台机器都要)

7、测试验证

 

 

1、下载rocketmq包

  下载地址:http://rocketmq.apache.org/dowloading/releases/

  我用的版本是 rocketmq-all-4.2.0-source-release.zip

2、解压zip包

[root@iZbp1hsztk393u9v8k87m3Z local]# unzip rocketmq-all-4.2.0-source-release.zip

3、编译部署

  前提是已经安装好maven

  进入到解压出来的目录 rocketmq-all-4.2.0,执行 mvn -Prelease-all -DskipTests clean install -U

  技术分享图片

  需要等待几分钟,完成显示

  技术分享图片

4、配置环境变量

  vi /etc/profile中添加

#set rocketmq
export rocketmq=/usr/local/rocketmq-all-4.2.0/distribution/target/apache-rocketmq
export PATH=$PATH:$rocketmq/bin

  添加后别忘了执行source /etc/profile,使环境变量生效

5、启动 NameServer(每台机器都要启动)

  进入到  /usr/local/rocketmq-all-4.2.0/distribution/target/apache-rocketmq 目录

  先在/usr/local/rocketmq-all-4.2.0目录下新建文件夹rocketmqlogs

  启动nameserver

nohup mqnamesrv > /usr/local/rocketmq-all-4.2.0/rocketmqlogs/namesrv.log 2>&1 &

  启动后查看日志文件是否正确启动,出现红框中的说明已经启动

  技术分享图片

  也可以使用jps命令查看

  技术分享图片

 

 

6、启动broker(每台机器都要)

  6.1 配置 broker-a.properties文件

    在最后一行添加 namesrvAddr=10.132.131.64:9876;10.132.131.81:9876;10.132.131.82:9876

    因为64/81/82三台机器都要安装rocketmq,做集群,同理配置,81机器的broker-b.properties文件,82机器的broker-c.properties文件

[root@iZbp1hsztk393u9v8k87mcZ 2m-noslave]# vi broker-a.properties
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
brokerClusterName=DefaultCluster
brokerName=broker-a
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
namesrvAddr=10.132.131.64:9876;10.132.131.81:9876;10.132.131.82:9876

 

   启动broker

nohup mqbroker -c /usr/local/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/conf/2m-noslave/broker-a.properties >/dev/null 2>&1 &

  jps查看下,已经启动

  技术分享图片

7、测试验证

  7.1 命令行验证

  最后使用clusterList命令来验证一下集群健康状态
  命令:

mqadmin clusterList -n 10.132.131.64:9876

  执行结果如下:

  技术分享图片

  三台机器都已经成功启动

   7.2 rocketmq-console页面验证

    这个更直观,搜一下很简单

rocketmq集群搭建

标签:res   集群   style   disk   more   conf   limit   roc   perm   

原文地址:https://www.cnblogs.com/gcgc/p/10343023.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!