美文网首页
docker-compose启动rocketmq

docker-compose启动rocketmq

作者: SailSea | 来源:发表于2020-09-01 17:02 被阅读0次

    目录结构

    ├── conf
    │ └── broker.conf
    ├── docker-compose.yaml
    ├── logs
    └── store

    docker-compose.yaml

    version: '2'
    services:
      namesrv:
        image: rocketmqinc/rocketmq
        container_name: rmqnamesrv
        restart: always    
        ports:
          - 9876:9876
        volumes:
          - ./logs:/home/rocketmq/logs
          - ./store:/home/rocketmq/store
        command: sh mqnamesrv
      broker:
        image: rocketmqinc/rocketmq
        container_name: rmqbroker
        restart: always    
        ports:
          - 10909:10909
          - 10911:10911
          - 10912:10912
        volumes:
          - ./logs:/home/rocketmq/logs
          - ./store:/home/rocketmq/store
          - ./conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf
        #command: sh mqbroker -n namesrv:9876
        command: sh mqbroker -n namesrv:9876 -c ../conf/broker.conf
        depends_on:
          - namesrv
        environment:
          - JAVA_HOME=/usr/lib/jvm/jre
      console:
        image: styletang/rocketmq-console-ng
        container_name: rocketmq-console-ng
        restart: always    
        ports:
          - 8076:8080
        depends_on:
          - namesrv
        environment:
          - JAVA_OPTS= -Dlogging.level.root=info   -Drocketmq.namesrv.addr=rmqnamesrv:9876 
          - Dcom.rocketmq.sendMessageWithVIPChannel=false
    
    

    conf文件:

    conf/broker.conf

    brokerName = broker-a  
    brokerId = 0  
    deleteWhen = 04  
    fileReservedTime = 48  
    brokerRole = ASYNC_MASTER  
    flushDiskType = ASYNC_FLUSH  
    # 如果是本地程序调用云主机 mq,这个需要设置成 云主机 IP
    brokerIP1=192.168.2.234
    

    在docker-compose.yaml同级目录执行

    docker-compose up -d
    

    docker-compose ps 查看启动状态

    [root@argrace-ci rocketmq]# docker-compose ps
           Name                      Command               State                                           Ports                                         
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    rmqbroker             sh mqbroker -n namesrv:987 ...   Up      0.0.0.0:10909->10909/tcp, 0.0.0.0:10911->10911/tcp, 0.0.0.0:10912->10912/tcp, 9876/tcp
    rmqnamesrv            sh mqnamesrv                     Up      10909/tcp, 10911/tcp, 0.0.0.0:9876->9876/tcp                                          
    rocketmq-console-ng   sh -c java $JAVA_OPTS -jar ...   Up      0.0.0.0:8076->8080/tcp  
    

    访问ip+8076即可

    相关文章

      网友评论

          本文标题:docker-compose启动rocketmq

          本文链接:https://www.haomeiwen.com/subject/jvivsktx.html