1. 下载RocketMQ所需的镜像
[root@iZuf616vx1rni5mn9jvi9oZ conf]
REPOSITORY TAG IMAGE ID CREATED SIZE
rocketmqinc/rocketmq latest 09bbc30a03b6 2 years ago 380MB
styletang/rocketmq-console-ng latest 7df83bb6e638 4 years ago 702MB
2.启动NameServer服务
创建NameServer数据存储路径:
mkdir -p /home/rocketmq/data/namesrv/logs /home/rocketmq/data/namesrv/store
构建 NameServer 容器
docker run -d --name rmqnamesrv -p 9876:9876 -v /home/rocketmq/data/namesrv/logs:/root/logs -v /home/rocketmq/data/namesrv/store:/root/store -e "MAX_POSSIBLE_HEAP=100000000" rocketmqinc/rocketmq sh mqnamesrv
3. 启动Broker服务
创建Broker数据存储路径:
mkdir -p /home/rocketmq/data/broker/logs /home/rocketmq/data/broker/store
创建conf目录
mkdir /home/rocketmq/conf
然后在/home/rocketmq/conf 目录下创建broker.conf 文件:
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = 服务器外网ip
构建 Broker 容器:
docker run -d --name rmqbroker --link rmqnamesrv:namesrv -p 10911:10911 -p 10909:10909 -v /home/rocketmq/data/broker/logs:/root/logs -v /home/rocketmq/data/broker/store:/root/store -v /home/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. 启动控制台
docker run -d --name rmqadmin -e "JAVA_OPTS=-Drocketmq.namesrv.addr=服务器外网ip:9876 \
-Dcom.rocketmq.sendMessageWithVIPChannel=false \
-Duser.timezone='Asia/Shanghai'" -v /etc/localtime:/etc/localtime -p 9999:8080 styletang/rocketmq-console-ng
查看docker运行的容器 最后访问http://服务器外网ip:9999/#/cluster
|