1.RocketMQ创建专属网络
[root@mq011 ~]# docker network create rocketmq 154dc65dce84ce5d417e9e2787bdd77de881ac65575e5e74fed4aeaf99830984 [root@mq011 ~]# docker inspect rocketmq [ { "Name": "rocketmq", "Id": "154dc65dce84ce5d417e9e2787bdd77de881ac65575e5e74fed4aeaf99830984", "Created": "2022-11-29T13:27:18.546560945+08:00", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": {}, "Config": [ { "Subnet": "172.18.0.0/16", "Gateway": "172.18.0.1" } ] }, "Internal": false, "Attachable": false, "Containers": {}, "Options": {}, "Labels": {} } ]
2.创建相关目录及配置文件
[root@mq011 ~]# mkdir -p /root/rocketmq/{broker,store}/{logs,store} [root@mq011 ~]# mkdir /root/rocketmq/broker/conf/ [root@mq011 ~]# cd /root/rocketmq/broker/conf/ [root@mq011 conf]# vim broker.conf brokerClusterName = DefaultCluster brokerName=broker-a brokerId=0 deleteWhen=04 fileReservedTime=48 brokerRole=ASYNC_MASTER flushDiskType=ASYNC_FLUSH brokerIP1=10.xx.xx.117 #宿主机IP地址,因为我有两个,内外网,按需设置 brokerIP2=47.xx.xx.137
3.部署namesvr
[root@mq011 conf]# docker run -d --name rmqnamesrv -p 9876:9876 --privileged=true --network rocketmq -v /root/rocketmq/namesrv/logs:/root/logs -v /root/rocketmq/namesrv/store:/root/rocketmq/store -e "MAX_POSSIBLE_HEAP=100000000" rocketmqinc/rocketmq:4.4.0 sh mqnamesrv autoCreateTopicEnable=true [root@mq011 conf]# docker ps -f name=rmqnamesrv CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4f36284850c5 rocketmqinc/rocketmq:4.4.0 "sh mqnamesrv auto..." About an hour ago Up About an hour 10909/tcp, 0.0.0.0:9876->9876/tcp, 10911/tcp rmqnamesrv
4.部署broker
[root@mq011 conf]# docker run -d --name rmqbroker -p 10911:10911 -p 10909:10909 --privileged=true --network rocketmq -v /root/rocketmq/broker/logs:/root/logs -v /root/rocketmq/broker/store:/root/store -v /root/rocketmq/broker/conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf -e "NAMESRV_ADDR=rmqnamesrv:9876" -e "MAX_POSSIBLE_HEAP=200000000" rocketmqinc/rocketmq:4.4.0 sh mqbroker autoCreateTopicEnable=true -c /opt/rocketmq-4.4.0/conf/broker.conf [root@mq011 conf]# docker ps -f name=rmqbroker CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 22a243a7c59f rocketmqinc/rocketmq:4.4.0 "sh mqbroker autoC..." About an hour ago Up About an hour 0.0.0.0:10909->10909/tcp, 9876/tcp, 0.0.0.0:10911->10911/tcp rmqbroker
5.部署rocketMQ console
[root@mq011 conf]# docker run -d --name rmqconsole -p 8080:8080 --network rocketmq -e "JAVA_OPTS=-Drocketmq.namesrv.addr=rmqnamesrv:9876" styletang/rocketmq-console-ng [root@mq011 conf]# docker ps -f name=rmqconsole CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 809de7301b81 styletang/rocketmq-console-ng "sh -c 'java $JAVA..." About an hour ago Up About an hour 0.0.0.0:8080->8080/tcp rmqconsole
6.验证
访问console
抄自于:http://www.manongjc.com/detail/28-qkjlpwrzcytphdi.html
标签:mq011,RockerMQ,broker,测试环境,conf,docker,root,rocketmq From: https://www.cnblogs.com/panwenbin-logs/p/16935430.html