提示:以下所有操作均需要在docker环境安装完毕后进行
1.拉取镜像(rocketmqinc/rocketmq),默认latest版本
docker pull rocketmqinc/rocketmq
#官方说apacherocketmq/rocketmq-console已迁移到以下镜像(rocketMQ控制台)
docker pull apacherocketmq/rocketmq-dashboard
2.启动namesrv
docker run -d \
--restart=always \
--name rmqnamesrv \
-p 9876:9876 \
-v /mydata/rocketmq/namesrv/logs:/root/logs \
-v /mydata/rocketmq/namesrv/store:/root/store \
-e "MAX_POSSIBLE_HEAP=100000000" \
rocketmqinc/rocketmq \
sh mqnamesrv
3.启动broker
(注意:以下路径 /opt/rocketmq-4.4.0/conf/broker.conf是启动namesrv后进入到容器可以查到的,目前latest版本是这个路径,以后可能会发生变动,需要关注dockerhub中的镜像有无更新)
docker run -d \
--restart=always \
--name rmqbroker \
--link rmqnamesrv:namesrv \
-p 10911:10911 \
-p 10909:10909 \
-v /mydata/rocketmq/broker/logs:/root/logs \
-v /mydata/rocketmq/broker/store:/root/store \
-v /mydata/rocketmq/conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf \
-e "NAMESRV_ADDR=namesrv:9876" \
-e "MAX_POSSIBLE_HEAP=200000000" \
rocketmqinc/rocketmq \
sh mqbroker -c /opt/rocketmq-4.4.0/conf/broker.conf
4.启动控制台
注意: 127.0.0.1需要替换成自己真是的namesrv启动的服务器ip
docker run -d \
--restart=always \
--name rmqadmin \
-e "JAVA_OPTS=-Drocketmq.namesrv.addr=127.0.0.1:9876 \
-Dcom.rocketmq.sendMessageWithVIPChannel=false" \
-p 9999:8080 \
apacherocketmq/rocketmq-dashboard
访问 ip:9999,可直接访问到MQ控制台界面