拉取镜像
docker pull foxiswho/rocketmq:server-4.6.1
docker pull foxiswho/rocketmq:broker-4.6.1
创建数据挂载目录
mkdir -p /usr/dockerrocketmq/rmqserver01/logs
mkdir -p /usr/dockerrocketmq/rmqserver01/store
mkdir -p /usr/dockerrocketmq/rmqbroker01/logs
mkdir -p /usr/dockerrocketmq/rmqbroker01/store
mkdir -p /usr/dockerrocketmq/rmqbroker01/conf
编辑配置文件
vi /usr/dockerrocketmq/rmqbroker01/conf/broker.conf
broker.conf
namesrvAddr=192.168.56.128:9876
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = 192.168.56.128
listenPort=10911
创建容器,启动容器
创建nameserver容器
docker create -p 9876:9876 --name rmqserver01 -e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" -e "JAVA_OPTS=-Duser.home=/opt" -v /usr/dockerrocketmq/rmqserver01/logs:/opt/logs -v /usr/dockerrocketmq/rmqserver01/store:/opt/store foxiswho/rocketmq:server-4.6.1
启动容器
docker start rmqserver01
docker run -it -d --net host --name rmqbroker01 -e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" -e "JAVA_OPTS=-Duser.home=/opt" -v /usr/dockerrocketmq/rmqbroker01/conf/broker.conf:/etc/rocketmq/broker.conf -v /usr/dockerrocketmq/rmqbroker01/logs:/opt/logs -v /usr/dockerrocketmq/rmqbroker01/store:/opt/store --privileged=true foxiswho/rocketmq:broker-4.6.1
部署RocketMQ的管理工具
RocketMQ提供了UI管理工具,名为rocketmq-console,我们选择docker安装
拉取镜像
docker pull styletang/rocketmq-console-ng:1.0.0
创建并启动容器 (解决时间报错问题)
docker run -d -e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.56.128:9876;192.168.56.128:9877 -Dcom.rocketmq.sendMessageWithVIPChannel=false -Duser.timezone='Asia/Shanghai' " -v /etc/localtime:/etc/localtime -p 8082:8080 -t styletang/rocketmq-console-ng:1.0.0
通过浏览器进行访问:
标签:rmqbroker01,dockerrocketmq,broker,拉取,usr,docker,rocketmq From: https://blog.51cto.com/u_13632845/6882820