Docker 部署 RocketMQ 服务
RocketMQ环境做准备
- 安装Linux 系统 ,配置ip为 192.168.1.100, ip对应
- 安装Docker环境
拉取 rocketmq 镜像版本
docker pull rocketmqinc/rocketmq:4.4.0
注意: Rocketmq 的服务端版本与客户端版本要一致! 不一致可能会出现异常的错误(难以发现)!
- docker 部署 rocketmq namesrv 服务
docker run -itd --name rocketmq_namesrv --restart=always \
-p 9876:9876 \
-v /etc/localtime:/etc/localtime:ro \
-v /data/rocketmq/namesrv:/home/rocketmq \
rocketmqinc/rocketmq:4.4.0 sh mqnamesrv autoCreateTopicEnable=true
- docker 部署 broker 服务(注意配置的路径修改)
docker run -d -p 10911:10911 -p 10909:10909 --restart=always \
-v /data/rocketmq/broker:/home/rocketmq:rw \
-v /deploy/etc/rocketmq-broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf \
-v /etc/localtime:/etc/localtime:ro \
--name rocketmq_broker -e "NAMESRV_ADDR=192.168.1.100:9876" \
-e "MAX_POSSIBLE_HEAP=200000000" \
rocketmqinc/rocketmq:4.4.0 sh mqbroker autoCreateTopicEnable=true -c /opt/rocketmq-4.4.0/conf/broker.conf
rocketmq-broker.conf
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = 192.168.1.100
autoCreateTopicEnable=true
- docker 部署 rocketmq console 控制台(注意namesrv的地址)
docker run -itd --name $name -m 500m --restart=always \
-e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.1.100:9876 \
-Dcom.rocketmq.sendMessageWithVIPChannel=false" \
-p 8080:8080 -t pangliang/rocketmq-console-ng