目录
目录结构
nameserver安装
broker安装
控制台安装
测试效果
rocket分为3个服务:nameserver、broker、dashboard
这边我计划分开安装:
安装版本为4.5.0
目录结构
规划的结构
命令
mkdir -p /apps/rocketmq/namesrv/{config,data,logs}
mkdir -p /apps/rocketmq/broker/{config,data,logs}
mkdir -p /apps/rocketmq/dashboard/{config,data,logs}
nameserver安装
我提前创建了个dev网络,用于网络共用
docker-comopose.yaml
version: "3.8"
services:
mqnamesrv:
image: apache/rocketmq:4.5.0
container_name: mqnamesrv
ports:
- 9876:9876
environment:
JAVA_OPT: -server -Xms512m -Xmx512m
volumes:
- /apps/rocketmq/namesrv/logs:/home/rocketmq/logs
command: sh mqnamesrv
networks:
- dev
networks:
dev:
external: true
安装完成启动
docker-compose up -d
查看日志:
docker logs -f mqnamesrv
已经启动完成
broker安装
注意:broker需要再nameserver启动后才能启动
broker.conf
config目录下面新增
内容
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
#set `brokerIP1` if you want to set physical IP as broker IP.
brokerIP1=192.168.1.115
namesrvAddr=192.168.1.115:9876
docker-comopose.yaml
注意,如果版本不一样,挂载镜像的时候目录也要改
version: "3"
services:
mqnamesrv:
image: apache/rocketmq:4.5.0
container_name: rmqbroker
ports:
- 10909:10909
- 10911:10911
- 10912:10912
environment:
JAVA_OPT_EXT: -server -Xms256m -Xmx256m -Xmn128m
NAMESRV_ADDR: 192.168.1.115:9876
volumes:
- /apps/rocketmq/broker/logs:/home/rocketmq/logs
- /apps/rocketmq/broker/data:/home/rocketmq/store
- /apps/rocketmq/broker/config/broker.conf:/home/rocketmq/rocketmq-4.5.0/conf/broker.conf
command: sh mqbroker -n 192.168.1.115:9876 -c /home/rocketmq/rocketmq-4.5.0/conf/broker.conf
networks:
- dev
networks:
dev:
external: true
启动日志
可以看到已经连上了name服务
控制台安装
docker-compose.yaml
version: '3'
services:
mqconsole:
image: apacherocketmq/rocketmq-dashboard
container_name: mqdashboard
ports:
- 8111:8080
environment:
JAVA_OPTS: -Drocketmq.namesrv.addr=192.168.1.115:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false
networks:
- dev
networks:
dev:
external: true
启动
测试效果
查看控制台
http://192.168.1.115:8111/
已经正常启动
集群和相关broker也已经注册上