codecamp

Docker 部署 RocketMQ 服务

RocketMQ环境做准备

拉取 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


RocketMQ 简介
RocketMQ 常规消息
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }