多架构环境下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

相关推荐
aherhuo34 分钟前
kubevirt网络
linux·云原生·容器·kubernetes
陌北v11 小时前
Docker Compose 配置指南
运维·docker·容器·docker-compose
catoop1 小时前
K8s 无头服务(Headless Service)
云原生·容器·kubernetes
阿里嘎多学长2 小时前
docker怎么部署高斯数据库
运维·数据库·docker·容器
明 庭2 小时前
Ubuntu下通过Docker部署Caddy服务器
服务器·ubuntu·docker
G_whang3 小时前
windos 安装docker
运维·docker·容器
Mitch3113 小时前
【漏洞复现】CVE-2021-45788 SQL Injection
sql·web安全·docker·prometheus·metersphere
运维小文3 小时前
K8S中的PV、PVC介绍和使用
docker·云原生·容器·kubernetes·存储
CYX_cheng4 小时前
Docker挂载
docker
ζั͡山 ั͡有扶苏 ั͡✾4 小时前
Kubeadm+Containerd部署k8s(v1.28.2)集群(非高可用版)
云原生·容器·kubernetes