创建数据挂载目录

mkdir -p /app/rocketmq/rmqserver01/logs
mkdir -p /app/rocketmq/rmqserver01/store
mkdir -p /app/rocketmq/rmqbroker01/logs
mkdir -p /app/rocketmq/rmqbroker01/store
mkdir -p /app/rocketmq/rmqbroker01/conf

编辑配置文件

vim /app/rocketmq/rmqbroker01/conf/broker.conf
namesrvAddr=192.168.92.129:9876
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
brokerIP1 = 192.168.92.129
listenPort=10911

创建nameserver容器

docker run \
-d \
-p 9876:9876 \
--name rmqserver01 \
-e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" -e "JAVA_OPTS=-Duser.home=/opt" \
-v /app/rocketmq/rmqserver01/logs:/opt/logs \
-v /app/rocketmq/rmqserver01/store:/opt/store \
--restart always \
foxiswho/rocketmq:server-4.7.0

创建rocketmq:broker容器

docker run -it -d --net host --name rmqbroker01 -e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m -Xmn128m" -e "JAVA_OPTS=-Duser.home=/opt" -v /app/rocketmq/rmqbroker01/conf/broker.conf:/etc/rocketmq/broker.conf -v /app/rocketmqq/rmqbroker01/logs:/opt/logs -v /app/rocketmq/rmqbroker01/store:/opt/store --privileged=true --restart always foxiswho/rocketmq:broker-4.7.0

启动rocketmq-console容器

docker run \
-d \
-p 8082:8080  \
-e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.92.129:9876;192.168.92.129:9877 -Dcom.rocketmq.sendMessageWithVIPChannel=false" \
--restart always \
styletang/rocketmq-console-ng:latest

http://192.168.92.129:8082/#/
在这里插入图片描述

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐