搭建准备以及环境清单如下:
system : windows
jdk : 1.8
rocketmq-version : 4.4.0
controller-manager : rocketmq-externals-master (from github)
集群架构图如下:
rocketmq集群架构图-采用多主从结构启动命令如下:
name-server-0 : ./bin/mqnamesrv.cmd -c ./prop/nameserver_0.properties
name-server-1 : ./bin/mqnamesrv.cmd -c ./prop/nameserver_1.properties
broker-a-master : ./bin/mqbroker.cmd -c ./prop/broker_a_master.properties -n "127.0.0.1:9788;127.0.0.1:9877"
broker-a-slave : ./bin/mqbroker.cmd -c ./prop/broker_a_slave.properties -n "127.0.0.1:9788;127.0.0.1:9877"
........
新增prop目录在根目录下,并添加响应配置文件
nameserver_0.properties
listenPort=9877
nameserver_1.properties
listenPort=9788
broker_a_master.properties
listenPort=10912
brokerName=Fernandes_broker_A
brokerClusterName=Fernandes_broker_cluster
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
storePathRootDir=C:/Users/xxx/Desktop/rocketmq-all-4.4.0-bin-release/broker_a_master_info
broker_a_slave.properties
listenPort=10919
brokerName=Fernandes_broker_A
brokerClusterName=Fernandes_broker_cluster
brokerId=1
deleteWhen=04
fileReservedTime=48
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
storePathRootDir=C:/Users/80021380/Desktop/rocketmq-all-4.4.0-bin-release/broker_a_slave_info
......
需要注意的坑:
1、windows环境下的启动脚本启动时会报错,原因是runbroker.cmd的脚本中第40行的classpath没有加" ",这应该是bug
2、在同一台机器搭建集群时,在配置文件中配置storePathRootDir会报错,原因是windows的文件分隔符一定要用 / ,一定不要用 \, 否则无法识别,这个地方也需要改改,这也是bug,因为其他配置项可以用默认的 \
关于rocketmq-externals-master (from github)
从gitbub上拉下来的源码需要编译,编译后使用rocketmq-console,在其target目录下启动即可,启动命令如下:
java -jar rocketmq-console-ng-1.0.0.jar --server.port=12581 --rocketmq.config.namesrvAddr=localhost:9877;localhost:9788
网友评论