接上篇linux上构建任意版本的rocketmq多架构x86 arm镜像——筑梦之路-CSDN博客,本文适用于x86、arm等多架构环境。
话不多说,直接上代码。
- #broker配置文件示例
- cat data/broker/conf/broker.conf
- brokerClusterName = DefaultCluster
- brokerName = broker-a
- brokerId = 0
- deleteWhen = 04
- fileReservedTime = 48
- brokerRole = ASYNC_MASTER
- flushDiskType = ASYNC_FLUSH
- autoCreateTopicEnable=true
- brokerIP1=[宿主机IP地址]
- namesrvAddr=namesrv:9876
- mkdir -p data/broker/{conf,logs,store}
- mkdir -p data/namesrv/logs
- chmod -R 777 data
- cat > docker-compose.yml << EOF
- version: '3'
- services:
- #Service for nameserver
- namesrv:
- image: harbor.codemiracle.com.cn/baseapp/rocketmq:4.8.0
- container_name: rmqnamesrv
- ports:
- - 9876:9876
- volumes:
- - ./data/namesrv/logs:/home/rocketmq/logs
- - /etc/localtime:/etc/localtime:ro
- command: sh mqnamesrv
- #Service for broker
- broker:
- image: harbor.codemiracle.com.cn/baseapp/rocketmq:4.8.0
- container_name: rmqbroker
- links:
- - namesrv
- ports:
- - 10909:10909
- - 10911:10911
- - 10912:10912
- environment:
- - NAMESRV_ADDR=namesrv:9876
- - MAX_POSSIBLE_HEAP=200000000
- volumes:
- - ./data/broker/logs:/home/rocketmq/logs
- - ./data/broker/store:/home/rocketmq/store
- - ./data/broker/conf/broker.conf:/opt/rocketmq-4.8.0/conf/broker.conf
- command: sh mqbroker -n namesrv:9876 -c /opt/rocketmq-4.8.0/conf/broker.conf
- #UI管理界面
- console:
- image: harbor.codemiracle.com.cn/baseapp/rocketmq-console:2.0.0
- container_name: rocketmq-console
- ports:
- - 8087:8080
- depends_on:
- - namesrv
- environment:
- - JAVA_OPTS= -Dlogging.level.root=info -Drocketmq.namesrv.addr=namesrv:9876
- - Dcom.rocketmq.sendMessageWithVIPChannel=false
- volumes:
- - /etc/localtime:/etc/localtime:ro
- EOF
- docker-compose up -d
-
- docker-compose logs -f
浏览器访问 http://[宿主机IP]:8087