开发者社区 > 云原生 > 云消息队列 > 正文

RocketMQ使用Docker-Compose部署同步双主双从的问题

  1. 在broker配置文件中配置如下内容,broker启动报空指针
    # 存储根目录
    storePathRootDir=/root/store
    # CommitLog存放路径
    storePathCommitLog=/root/store/commitlog
    # 消息存放路径
    storePathConsumeQueue=/root/store/consumequeue
    # 消息索引存放路径
    storePathIndex=/root/store/index
    
  2. proxy每台服务器上启动均失败,提示
    create system broadcast topic DefaultHeartBeatSyncerTopic failed on cluster DefaultCluster
    
    rmq-proxy.json
    {
    // 集群名称
    "rocketMQClusterName": "DefaultCluster",
    // 代理监听端口
    "remotingListenPort": 8080,
    // gRPC服务器端口
    "grpcServerPort": 8081,
    // 对应namesr的ip
    "namesrvAddr":"172.16.69.243:9876"
    }
    
    部署yml
  • 172.16.69.243
services:
  nameserver:
    image: apache/rocketmq:5.3.0
    command: sh mqnamesrv
    container_name: nameserver
    ports:
      - 9876:9876

  broker:
    image: apache/rocketmq:5.3.0
    command: sh mqbroker -c /etc/rocketmq/broker-a.properties autoCreateTopicEnable=true
    volumes:
      - /rocketmq/conf:/etc/rocketmq
      - /rocketmq/store:/root/store
    ports:
      - 10909:10909
      - 10911:10911
      - 10912:10912
    depends_on:
      - nameserver
    container_name: broker

  proxy:
    image: apache/rocketmq:5.3.0
    container_name: proxy
    depends_on:
      - nameserver
      - broker
    volumes:
      - /rocketmq/conf:/etc/rocketmq
    command: sh mqproxy -pc /etc/rocketmq/rmq-proxy.json
    ports:
      - 8080:8080
      - 8081:8081
    restart: on-failure
  • 172.16.69.244

    services:
    nameserver:
      image: apache/rocketmq:5.3.0
      command: sh mqnamesrv
      container_name: nameserver
      ports:
        - 9876:9876
    
    broker:
      image: apache/rocketmq:5.3.0
      command: sh mqbroker -c /etc/rocketmq/broker-a-s.properties autoCreateTopicEnable=true
      volumes:
        - /rocketmq/conf:/etc/rocketmq
        - /rocketmq/store:/root/store
      ports:
        - 10909:10909
        - 10911:10911
        - 10912:10912
      depends_on:
        - nameserver
      container_name: broker
    
    proxy:
      image: apache/rocketmq:5.3.0
      container_name: proxy
      depends_on:
        - nameserver
        - broker
      volumes:
        - /rocketmq/conf:/etc/rocketmq
      command: sh mqproxy -pc /etc/rocketmq/rmq-proxy.json
      ports:
        - 8080:8080
        - 8081:8081
      restart: on-failure
    

展开
收起
ichampion_tcys 2024-09-19 14:43:32 98 0
1 条回答
写回答
取消 提交回答
  • 检查存储路径:确保/root/store目录在容器内存在,并且具有正确的权限。
    确认Nameserver状态:检查Nameserver的日志,确认其是否成功启动。
    检查Broker集群配置:确认所有Broker都有正确的集群配置,并且能够互相通信。
    验证Proxy配置:确认rmq-proxy.json配置文件中的namesrvAddr字段指向了正确的Nameserver地址,并且该地址可达。
    审查Docker Compose文件:确保所有服务都在同一网络内,并且依赖关系正确设置。

    2024-09-19 15:09:53
    赞同 179 展开评论 打赏

涵盖 RocketMQ、Kafka、RabbitMQ、MQTT、轻量消息队列(原MNS) 的消息队列产品体系,全系产品 Serverless 化。RocketMQ 一站式学习:https://rocketmq.io/

相关产品

  • 云消息队列 MQ
  • 热门讨论

    热门文章

    相关电子书

    更多
    RocketMQ Client-GO 介绍 立即下载
    RocketMQ Prometheus Exporter 打造定制化 DevOps 平台 立即下载
    基于 RocketMQ Prometheus Exporter 打造定制化 DevOps 平台 立即下载