docker部署rocketmq

1.创建namesrv服务

1.1 拉镜像

docker pull rocketmqinc/rocketmq

1.2 加挂载目录

以我的本机为例,E:\data\rocketmq-data下创建broker和nameserver文件夹

docker部署rocketmq_第1张图片

 nameserver文件夹下建logs和store目录

docker部署rocketmq_第2张图片

 1.3 启动

#启动nameserver
docker run -d --restart=always --name rmqnamesrv --privileged=true -p 9876:9876  -v E:/data/rocketmq-data/nameserver/logs:/root/logs -v E:/data/rocketmq-data/nameserver/store:/root/store -e "MAX_POSSIBLE_HEAP=100000000" rocketmqinc/rocketmq sh mqnamesrv

2.创建broker

2.1 加挂载目录

broker文件夹下建conf,logs,store 三个文件夹

docker部署rocketmq_第3张图片

conf文件夹下建broker.conf文件

 docker部署rocketmq_第4张图片

 broker.conf文件内容如下

brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = 192.168.2.101

2.2 启动broker

#启动broker
docker run -d --restart=always --name rmqbroker --link rmqnamesrv:namesrv -p 10911:10911 -p 10909:10909 --privileged=true -v E:/data/rocketmq-data/broker/logs:/root/logs -v E:/data/rocketmq-data/broker/store:/root/store -v E:/data/rocketmq-data/broker/conf/broker.conf:/opt/docker/rocketmq/conf/broker.conf -e "NAMESRV_ADDR=namesrv:9876" -e "MAX_POSSIBLE_HEAP=200000000" rocketmqinc/rocketmq sh mqbroker -c /opt/docker/rocketmq/conf/broker.conf

3.创建rockermq-console服务

3.1 拉镜像

docker pull pangliang/rocketmq-console-ng

3.2 启动

docker run -d --restart=always --name rmqadmin -e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.2.101:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false" -p 9999:8080 pangliang/rocketmq-console-ng

3.3 访问

http://192.168.2.101:9999/#/cluster

docker部署rocketmq_第5张图片

你可能感兴趣的:(记录电商开发环境搭建的全过程,docker,rocketmq,容器)