多架构环境下docker-compose部署rocketmq单机模式—— 筑梦之路

接上篇linux上构建任意版本的rocketmq多架构x86 arm镜像------筑梦之路-CSDN博客,本文适用于x86、arm等多架构环境。

话不多说,直接上代码。

准备broker配置文件

bash 复制代码
#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

准备所需目录并赋权

bash 复制代码
mkdir -p data/broker/{conf,logs,store}
mkdir -p data/namesrv/logs
chmod -R 777 data

编写docker-compose.yml文件

bash 复制代码
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

启动服务并访问UI控制台界面

bash 复制代码
docker-compose  up -d

docker-compose logs -f

浏览器访问 http://[宿主机IP]:8087

相关推荐
昌sit!5 小时前
K8S node节点没有相应的pod镜像运行故障处理办法
云原生·容器·kubernetes
追风林6 小时前
mac 本地docker-mysql主从复制部署
mysql·macos·docker
A ?Charis8 小时前
Gitlab-runner running on Kubernetes - hostAliases
容器·kubernetes·gitlab
城南vision8 小时前
Docker学习—Docker核心概念总结
java·学习·docker
wclass-zhengge8 小时前
Docker篇(Docker Compose)
运维·docker·容器
北漂IT民工_程序员_ZG9 小时前
k8s集群安装(minikube)
云原生·容器·kubernetes
梦魇梦狸º12 小时前
腾讯轻量云服务器docker拉取不到镜像的问题:拉取超时
docker·容器·github
鬼才血脉12 小时前
docker+mysql配置
mysql·adb·docker
詹姆斯爱研究Java12 小时前
Docker 的基本概念和优势
docker
南猿北者14 小时前
docker镜像仓库常用命令
运维·docker·容器