栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

源码安装roketmq集群

源码安装roketmq集群

首先是要下载roketmq相关源码包

A、部署broker服务
1、编写启动脚本
节点一

[root@ip-172-93-1-173 rocketmq]# cat run_broker-a-s.sh 
nohup bash bin/mqbroker -c conf/2m-2s-sync/broker-a-s.properties > logs/broker-a-s.log 2>&1 &
[root@ip-172-93-1-173 rocketmq]# cat run_broker-b.sh 
nohup bash bin/mqbroker -c conf/2m-2s-sync/broker-b.properties > logs/broker-b.log 2>&1 &

节点二

[root@ip-172-93-1-93 rocketmq]# cat run_broker-a.sh 
nohup bash bin/mqbroker -c conf/2m-2s-sync/broker-a.properties > logs/broker-a.log 2>&1 &
[root@ip-172-93-1-93 rocketmq]# cat run_broker-b-s.sh 
nohup bash bin/mqbroker -c conf/2m-2s-sync/broker-b-s.properties > logs/broker-b-s.log 2>&1 &

2、编写配置文件
节点一

[root@ip-172-93-1-173 rocketmq]# cat conf/2m-2s-sync/broker-a-s.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=1
deleteWhen=04
fileReservedTime=48
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
[root@ip-172-93-1-173 rocketmq]# cat conf/2m-2s-sync/broker-b.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-b
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=SYNC_MASTER
flushDiskType=ASYNC_FLUSH

节点二:

[root@ip-172-93-1-93 rocketmq]# cat conf/2m-2s-sync/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=rocketmq-cluster
brokerName=broker-a
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=SYNC_MASTER
flushDiskType=ASYNC_FLUSH
brokerIP1=172.93.1.93
namesrvAddr=172.93.1.93:9876;172.93.1.173:9876
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10911
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000
diskMaxUsedSpaceRatio=88
storePathRootDir=/data/deploy/rocketmq/store/broker-a
storePathCommitLog=/data/deploy/rocketmq/store/broker-a/commitlog
storePathConsumeQueue=/data/deploy/rocketmq/store/broker-a/consumequeue
storePathIndex=/data/deploy/rocketmq/store/broker-a/index
storeCheckpoint=/data/deploy/rocketmq/store/checkpoint
abortFile=/data/deploy/rocketmq/store/abort
#maxMessageSize=65536
maxMessageSize=2097152

[root@ip-172-93-1-93 rocketmq]# cat conf/2m-2s-sync/broker-b-s.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=rocketmq-cluster
brokerName=broker-b
brokerId=1
deleteWhen=04
fileReservedTime=48
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
brokerIP1=172.93.1.93
namesrvAddr=172.93.1.93:9876;172.93.1.173:9876
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10920
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000
diskMaxUsedSpaceRatio=88
storePathRootDir=/data/deploy/rocketmq/store/broker-b-s
storePathCommitLog=/data/deploy/rocketmq/store/broker-b-s/commitlog
storePathConsumeQueue=/data/deploy/rocketmq/store/broker-b-s/consumequeue
storePathIndex=/data/deploy/rocketmq/store/broker-b-s/index
storeCheckpoint=/data/deploy/rocketmq/store/checkpoint
abortFile=/data/deploy/rocketmq/store/abort
#maxMessageSize=65536
maxMessageSize=2097152

3、启动脚本
节点一

[root@ip-172-93-1-173 rocketmq]# sh run_broker-b.sh

[root@ip-172-93-1-173 rocketmq]# sh run_broker-a-s.sh

节点二

[root@ip-172-93-1-93 rocketmq]# sh run_broker-a.sh

[root@ip-172-93-1-93 rocketmq]# sh run_broker-b-s.sh

B、部署nameserver
1、编写脚本
节点一

[root@ip-172-93-1-173 rocketmq]# cat run_mqnamesrv.sh 
nohup bash bin/mqnamesrv > logs/mqnamesrv.log 2>&1 &

节点二

[root@ip-172-93-1-93 rocketmq]# cat run_mqnamesrv.sh 
nohup bash bin/mqnamesrv > logs/mqnamesrv.log 2>&1 &

启动脚本
2、执行脚本启动服务

[root@ip-172-93-1-173 rocketmq]# sh run_mqnamesrv.sh

[root@ip-172-93-1-93 rocketmq]# sh run_mqnamesrv.sh

C、部署rocketmq-console
1、编写docker-compose文件

[root@ip-172-93-1-173 rocketmq-console]# cat docker-compose.yaml 
version: '3.5'
services:
  rmqconsole:
    image: styletang/rocketmq-console-ng
    container_name: rocketmq-console
    restart: always
    ports:
      - 18181:8080
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./console/logs:/root/logs
    environment:
      JAVA_OPTS: "-Drocketmq.namesrv.addr=172.93.1.93:9876;172.93.1.173:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"

2、启动容器

[root@ip-172-93-1-173 rocketmq-console]# docker-compose  up -d

3、查看容器运行与否

[root@ip-172-93-1-173 rocketmq-console]# docker-compose  ps
      Name                    Command               State                     Ports                   
------------------------------------------------------------------------------------------------------
rocketmq-console   sh -c java $JAVA_OPTS -jar ...   Up      0.0.0.0:18181->8080/tcp,:::18181->8080/tcp

4、web端查看检查
1)ops页面

2)cluster集群页面

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/721790.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号