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/bin
nohup 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/bin
nohup 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/bin
nohup 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/bin
nohup sh mqbroker -c /usr/local/rocketMQ/rocketmq-all-4.4.0-bin-release/conf/2m-2s-sync/broker-a-s.properties &
记得启动四个namesrv…
是搭建失败了
有空看看