# 自用集群搭建Cluster
创始人
2024-02-05 23:10:23

Redis集群

MySQL集群

Zookeeper集群

server.1=192.168.81.133:2881:3881
server.2=192.168.81.133:2882:3882
server.3=192.168.81.133:2883:3883

$ cd …/zkdata
$ touch myid
$ echo “1”>>myid
echo “2”>>myid
echo “3”>>myid

vim zoo.cfg

dataDir=/usr/local/zookeeper-cluster/zookeeper01/zookeeper-3.4.6/zkdata
clientPort=2181
server.1=192.168.81.133:2881:3881
server.2=192.168.81.133:2882:3882
server.3=192.168.81.133:2883:3883
dataDir=/usr/local/zookeeper-cluster/zookeeper02/zookeeper-3.4.6/zkdata
clientPort=2182
server.1=192.168.81.133:2881:3881
server.2=192.168.81.133:2882:3882
server.3=192.168.81.133:2883:3883
dataDir=/usr/local/zookeeper-cluster/zookeeper03/zookeeper-3.4.6/zkdata
clientPort=2183
server.1=192.168.81.133:2881:3881
server.2=192.168.81.133:2882:3882
server.3=192.168.81.133:2883:3883

开发firewall
同时开启三个zookeeper

[vincent@rocketmq-nameserver1 bin]$ su root
密码:
[root@rocketmq-nameserver1 bin]# zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper-cluster/zookeeper01/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@rocketmq-nameserver1 bin]# cd ../
[root@rocketmq-nameserver1 zookeeper-3.4.6]# cd ../../
[root@rocketmq-nameserver1 zookeeper-cluster]# cd zookeeper02
[root@rocketmq-nameserver1 zookeeper02]# cd zookeeper-3.4.6/bin
[root@rocketmq-nameserver1 bin]# zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper-cluster/zookeeper02/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@rocketmq-nameserver1 bin]# cd ../../../
[root@rocketmq-nameserver1 zookeeper-cluster]# cd zookeeper03/zookeeper-3.4.6/bin
[root@rocketmq-nameserver1 bin]# zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper-cluster/zookeeper03/zookeeper-3.4.6/bin/../conf/zoo.cfg
mkdir: 无法创建目录"": 没有那个文件或目录
Starting zookeeper ... STARTED
[root@rocketmq-nameserver1 bin]# 

在这里插入图片描述
zookeeper集群搭建成功

Dubbo集群

RocketMQ集群

192.168.81.133

192.168.81.136

vim /etc/hosts

# nameserver
1192.168.81.133 rocketmq-nameserver1
192.168.81.136 rocketmq-nameserver2
# broker
192.168.81.133 rocketmq-master1
192.168.81.133 rocketmq-slave2
192.168.81.136 rocketmq-master2
192.168.81.136 rocketmq-slave1

systemctl restart network

192.168.81.133

vi /usr/soft/rocketmq/conf/2m-2s-sync/broker-a.properties

#所属集群名字
brokerClusterName=rocketmq-cluster
#broker名字,注意此处不同的配置文件填写的不一样
brokerName=broker-a
#0 表示 Master,>0 表示 Slave
brokerId=0
#nameServer地址,分号分割
namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876
#在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
defaultTopicQueueNums=4
#是否允许 Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
#是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
#Broker 对外服务的监听端口
listenPort=10911
#删除文件时间点,默认凌晨 4点
deleteWhen=04
#文件保留时间,默认 48 小时
fileReservedTime=120
#commitLog每个文件的大小默认1G
mapedFileSizeCommitLog=1073741824
#ConsumeQueue每个文件默认存30W条,根据业务情况调整
mapedFileSizeConsumeQueue=300000
#destroyMapedFileIntervalForcibly=120000
#redeleteHangedFileInterval=120000
#检测物理文件磁盘空间
diskMaxUsedSpaceRatio=88
#存储路径
storePathRootDir=/usr/local/rocketMQ/store
#commitLog 存储路径
storePathCommitLog=/usr/local/rocketMQ/store/commitlog
#消费队列存储路径存储路径
storePathConsumeQueue=/usr/local/rocketMQ/store/consumequeue
#消息索引存储路径
storePathIndex=/usr/local/rocketMQ/store/index
#checkpoint 文件存储路径
storeCheckpoint=/usr/local/rocketMQ/store/checkpoint
#abort 文件存储路径
abortFile=/usr/local/rocketMQ/store/abort
#限制的消息大小
maxMessageSize=65536
#flushCommitLogLeastPages=4
#flushConsumeQueueLeastPages=2
#flushCommitLogThoroughInterval=10000
#flushConsumeQueueThoroughInterval=60000
#Broker 的角色
#- ASYNC_MASTER 异步复制Master
#- SYNC_MASTER 同步双写Master
#- SLAVE
brokerRole=SYNC_MASTER
#刷盘方式
#- ASYNC_FLUSH 异步刷盘
#- SYNC_FLUSH 同步刷盘
flushDiskType=SYNC_FLUSH
#checkTransactionMessageEnable=false
#发消息线程池数量
#sendMessageThreadPoolNums=128
#拉消息线程池数量
#pullMessageThreadPoolNums=128

vi /usr/soft/rocketmq/conf/2m-2s-sync/broker-b-s.properties

#所属集群名字
brokerClusterName=rocketmq-cluster
#broker名字,注意此处不同的配置文件填写的不一样
brokerName=broker-b
#0 表示 Master,>0 表示 Slave
brokerId=1
#nameServer地址,分号分割
namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876
#在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
defaultTopicQueueNums=4
#是否允许 Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
#是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
#Broker 对外服务的监听端口
listenPort=11011
#删除文件时间点,默认凌晨 4点
deleteWhen=04
#文件保留时间,默认 48 小时
fileReservedTime=120
#commitLog每个文件的大小默认1G
mapedFileSizeCommitLog=1073741824
#ConsumeQueue每个文件默认存30W条,根据业务情况调整
mapedFileSizeConsumeQueue=300000
#destroyMapedFileIntervalForcibly=120000
#redeleteHangedFileInterval=120000
#检测物理文件磁盘空间
diskMaxUsedSpaceRatio=88
#存储路径
storePathRootDir=/usr/local/rocketMQ/store
#commitLog 存储路径
storePathCommitLog=/usr/local/rocketMQ/store/commitlog
#消费队列存储路径存储路径
storePathConsumeQueue=/usr/local/rocketMQ/store/consumequeue
#消息索引存储路径
storePathIndex=/usr/local/rocketMQ/store/index
#checkpoint 文件存储路径
storeCheckpoint=/usr/local/rocketMQ/store/checkpoint
#abort 文件存储路径
abortFile=/usr/local/rocketMQ/store/abort
#限制的消息大小
maxMessageSize=65536
#flushCommitLogLeastPages=4
#flushConsumeQueueLeastPages=2
#flushCommitLogThoroughInterval=10000
#flushConsumeQueueThoroughInterval=60000
#Broker 的角色
#- ASYNC_MASTER 异步复制Master
#- SYNC_MASTER 同步双写Master
#- SLAVE
brokerRole=SLAVE
#刷盘方式
#- ASYNC_FLUSH 异步刷盘
#- SYNC_FLUSH 同步刷盘
flushDiskType=ASYNC_FLUSH
#checkTransactionMessageEnable=false
#发消息线程池数量
#sendMessageThreadPoolNums=128
#拉消息线程池数量
#pullMessageThreadPoolNums=128

192.168.81.136

vi /usr/soft/rocketmq/conf/2m-2s-sync/broker-b.properties

#所属集群名字
brokerClusterName=rocketmq-cluster
#broker名字,注意此处不同的配置文件填写的不一样
brokerName=broker-b
#0 表示 Master,>0 表示 Slave
brokerId=0
#nameServer地址,分号分割
namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876
#在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
defaultTopicQueueNums=4
#是否允许 Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
#是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
#Broker 对外服务的监听端口
listenPort=10911
#删除文件时间点,默认凌晨 4点
deleteWhen=04
#文件保留时间,默认 48 小时
fileReservedTime=120
#commitLog每个文件的大小默认1G
mapedFileSizeCommitLog=1073741824
#ConsumeQueue每个文件默认存30W条,根据业务情况调整
mapedFileSizeConsumeQueue=300000
#destroyMapedFileIntervalForcibly=120000
#redeleteHangedFileInterval=120000
#检测物理文件磁盘空间
diskMaxUsedSpaceRatio=88
#存储路径
storePathRootDir=/usr/local/rocketMQ/store
#commitLog 存储路径
storePathCommitLog=/usr/local/rocketMQ/store/commitlog
#消费队列存储路径存储路径
storePathConsumeQueue=/usr/local/rocketMQ/store/consumequeue
#消息索引存储路径
storePathIndex=/usr/local/rocketMQ/store/index
#checkpoint 文件存储路径
storeCheckpoint=/usr/local/rocketMQ/store/checkpoint
#abort 文件存储路径
abortFile=/usr/local/rocketMQ/store/abort
#限制的消息大小
maxMessageSize=65536
#flushCommitLogLeastPages=4
#flushConsumeQueueLeastPages=2
#flushCommitLogThoroughInterval=10000
#flushConsumeQueueThoroughInterval=60000
#Broker 的角色
#- ASYNC_MASTER 异步复制Master
#- SYNC_MASTER 同步双写Master
#- SLAVE
brokerRole=SYNC_MASTER
#刷盘方式
#- ASYNC_FLUSH 异步刷盘
#- SYNC_FLUSH 同步刷盘
flushDiskType=SYNC_FLUSH
#checkTransactionMessageEnable=false
#发消息线程池数量
#sendMessageThreadPoolNums=128
#拉消息线程池数量
#pullMessageThreadPoolNums=128

vi /usr/soft/rocketmq/conf/2m-2s-sync/broker-a-s.properties

#所属集群名字
brokerClusterName=rocketmq-cluster
#broker名字,注意此处不同的配置文件填写的不一样
brokerName=broker-a
#0 表示 Master,>0 表示 Slave
brokerId=1
#nameServer地址,分号分割
namesrvAddr=rocketmq-nameserver1:9876;rocketmq-nameserver2:9876
#在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
defaultTopicQueueNums=4
#是否允许 Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
#是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
#Broker 对外服务的监听端口
listenPort=11011
#删除文件时间点,默认凌晨 4点
deleteWhen=04
#文件保留时间,默认 48 小时
fileReservedTime=120
#commitLog每个文件的大小默认1G
mapedFileSizeCommitLog=1073741824
#ConsumeQueue每个文件默认存30W条,根据业务情况调整
mapedFileSizeConsumeQueue=300000
#destroyMapedFileIntervalForcibly=120000
#redeleteHangedFileInterval=120000
#检测物理文件磁盘空间
diskMaxUsedSpaceRatio=88
#存储路径
storePathRootDir=/usr/local/rocketMQ/store
#commitLog 存储路径
storePathCommitLog=/usr/local/rocketMQ/store/commitlog
#消费队列存储路径存储路径
storePathConsumeQueue=/usr/local/rocketMQ/store/consumequeue
#消息索引存储路径
storePathIndex=/usr/local/rocketMQ/store/index
#checkpoint 文件存储路径
storeCheckpoint=/usr/local/rocketMQ/store/checkpoint
#abort 文件存储路径
abortFile=/usr/local/rocketMQ/store/abort
#限制的消息大小
maxMessageSize=65536
#flushCommitLogLeastPages=4
#flushConsumeQueueLeastPages=2
#flushCommitLogThoroughInterval=10000
#flushConsumeQueueThoroughInterval=60000
#Broker 的角色
#- ASYNC_MASTER 异步复制Master
#- SYNC_MASTER 同步双写Master
#- SLAVE
brokerRole=SLAVE
#刷盘方式
#- ASYNC_FLUSH 异步刷盘
#- SYNC_FLUSH 同步刷盘
flushDiskType=ASYNC_FLUSH
#checkTransactionMessageEnable=false
#发消息线程池数量
#sendMessageThreadPoolNums=128
#拉消息线程池数量
#pullMessageThreadPoolNums=128

WENJIAN
/usr/local/rocketMQ/rocketmq-all-4.4.0-bin-release/conf/2m-2s-sync

MASTER1

cd /usr/local/rocketmq/binnohup sh mqbroker -c /usr/local/rocketMQ/rocketmq-all-4.4.0-bin-release/conf/2m-2s-sync
/broker-a.properties &

SLAVE2

cd /usr/local/rocketmq/binnohup sh mqbroker -c /usr/local/rocketMQ/rocketmq-all-4.4.0-bin-release/conf/2m-2s-sync/
broker-b-s.properties &

MASTER2

/usr/local/rocketMQ/rocketmq-all-4.4.0-bin-release/conf/2m-2s-sync

cd /usr/local/rocketmq/binnohup sh mqbroker -c usr/local/rocketMQ/rocketmq-all-4.4.0-bin-release/conf/2m-2s-sync/broker-b.properties &

SLAVE1

cd /usr/local/rocketmq/binnohup sh mqbroker -c /usr/local/rocketMQ/rocketmq-all-4.4.0-bin-release/conf/2m-2s-sync/broker-a-s.properties &

记得启动四个namesrv…
是搭建失败了
有空看看
在这里插入图片描述

Nginx集群

Tomcat集群

相关内容

热门资讯

埃菲尔铁塔在哪 中国仿建埃菲尔... 2019年4月26日,广西南宁市,街头惊现一座巨型山寨版埃菲尔铁塔,高约20米,白色塔身,造型逼真,...
北京的名胜古迹 北京最著名的景... 北京从元代开始,逐渐走上帝国首都的道路,先是成为大辽朝五大首都之一的南京城,随着金灭辽,金代从海陵王...
长白山自助游攻略 吉林长白山游... 昨天介绍了西坡的景点详细请看链接:一个人的旅行,据说能看到长白山天池全凭运气,您的运气如何?今日介绍...
苗族的传统节日 贵州苗族节日有... 【岜沙苗族芦笙节】岜沙,苗语叫“分送”,距从江县城7.5公里,是世界上最崇拜树木并以树为神的枪手部落...
猫咪吃了塑料袋怎么办 猫咪误食... 你知道吗?塑料袋放久了会长猫哦!要说猫咪对塑料袋的喜爱程度完完全全可以媲美纸箱家里只要一有塑料袋的响...
世界上最漂亮的人 世界上最漂亮... 此前在某网上,选出了全球265万颜值姣好的女性。从这些数量庞大的女性群体中,人们投票选出了心目中最美...
应用未安装解决办法 平板应用未... ---IT小技术,每天Get一个小技能!一、前言描述苹果IPad2居然不能安装怎么办?与此IPad不...
demo什么意思 demo版本... 618快到了,各位的小金库大概也在准备开闸放水了吧。没有小金库的,也该向老婆撒娇卖萌服个软了,一切只...
埃菲尔铁塔在哪 中国仿建埃菲尔... 2019年4月26日,广西南宁市,街头惊现一座巨型山寨版埃菲尔铁塔,高约20米,白色塔身,造型逼真,...
北京的名胜古迹 北京最著名的景... 北京从元代开始,逐渐走上帝国首都的道路,先是成为大辽朝五大首都之一的南京城,随着金灭辽,金代从海陵王...
苗族的传统节日 贵州苗族节日有... 【岜沙苗族芦笙节】岜沙,苗语叫“分送”,距从江县城7.5公里,是世界上最崇拜树木并以树为神的枪手部落...
应用未安装解决办法 平板应用未... ---IT小技术,每天Get一个小技能!一、前言描述苹果IPad2居然不能安装怎么办?与此IPad不...
脚上的穴位图 脚面经络图对应的... 人体穴位作用图解大全更清晰直观的标注了各个人体穴位的作用,包括头部穴位图、胸部穴位图、背部穴位图、胳...
长白山自助游攻略 吉林长白山游... 昨天介绍了西坡的景点详细请看链接:一个人的旅行,据说能看到长白山天池全凭运气,您的运气如何?今日介绍...