基于docker的RocketMQ的安装

基于docker的RocketMQ的安装

在compose文件夹下创建rocket文件夹,在创建一下文件
/root/app/compose/rocket
创建 docker-compose.yml 文件

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文件夹
/root/app/compose/rocket/conf
创建broker.conf文件

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

image
执行 docker-compose up -d
接下来交给docker,会自动pull镜像进行安装<和上面步骤是一样的>
结束后docker ps 如下所示
image
访问链接 即可进入控制台管理页面
http://192.168.2.225:8076/#/
image

posted @ 2021-03-26 17:15  darling331  阅读(291)  评论(4编辑  收藏  举报