docker-compose部署rocketmq

部署rocketmq

docker-compose安装:

1.从github上下载docker-compose二进制文件安装

​ Ubuntu下载docker-compose文件

sudo curl -L https://github.com/docker/compose/releases/download/1.27.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

​ CentOs下载docker-compose文件

curl -L https://github.com/docker/compose/releases/download/1.27.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
2.添加可执行权限
chmod +x /usr/local/bin/docker-compose
2.测试安装结果
docker-compose --version
3.手动下载

官网选择版本 https://github.com/docker/compose/releases 选择相应版本,下载docker-compose-Linux-x86_64到本地或者服务器中 更名为docker-compose,并移动到 /usr/local/bin 目录下

1,新建挂载目录:
mkdir -p /my/config/rocketmq/
mkdir -p /my/rocketmq/broker-logs/
mkdir -p /my/rocketmq/broker-store/
mkdir -p /my/rocketmq/logs/
mkdir -p /my/rocketmq/logs/

2,pull相关的镜像:

docker pull foxiswho/rocketmq:server-4.5.2
docker pull foxiswho/rocketmq:broker-4.5.2
docker pull styletang/rocketmq-console-ng

3,编写broker.conf:

cd /my/config/rocketmq/
vim broker.conf

内容为:

brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
autoCreateTopicEnable = true
# 如果是本地程序调用云主机 mq,这个需要设置成 云主机 IP
brokerIP1=<your ip>
namesrvAddr=<your ip>:9876

4,编写docker-compose.yaml:

cd /my/rocketmq
vim docker-compose.yaml

内容为:

version: '3.5'
services:
  rmqnamesrv:
    image: foxiswho/rocketmq:server-4.5.2
    container_name: rmqnamesrv
    ports:
      -  9876:9876
    volumes:
      - /my/rocketmq/logs:/opt/logs
      - /my/rocketmq/store:/opt/store
    networks:
        rmq:
          aliases:
            - rmqnamesrv

  rmqbroker:
    image: foxiswho/rocketmq:broker-4.5.2
    container_name: rmqbroker
    ports:
      - 10909:10909
      - 10911:10911
    volumes:
      - /my/rocketmq/broker-logs:/root/logs/rocketmqlogs
      - /my/rocketmq/broker-store:/opt/store
      - /my/config/rocketmq/broker.conf:/etc/rocketmq/broker.conf
    environment:
        NAMESRV_ADDR: "rmqnamesrv:9876"
        JAVA_OPTS: " -Duser.home=/opt"
        JAVA_OPT_EXT: "-server -Xms128m -Xmx128m -Xmn128m"
    command: mqbroker -c /etc/rocketmq/broker.conf
    depends_on:
      - rmqnamesrv
    networks:
      rmq:
        aliases:
          - rmqbroker

  rmqconsole:
    image: styletang/rocketmq-console-ng
    container_name: rmqconsole
    ports:
      - 8087:8080
    environment:
        JAVA_OPTS: "-Drocketmq.namesrv.addr=rmqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"
    depends_on:
      - rmqnamesrv
    networks:
      rmq:
        aliases:
          - rmqconsole

networks:
  rmq:
    name: rmq
    driver: bridge

4,在/my/rocketmq下运行:

docker-compose up
#关闭
docker-compose down

检查docker容器:

docker ps
相关推荐
有来技术2 小时前
Docker 部署 MongoDB
mongodb·docker
陌殇殇殇4 小时前
基于Kubernetes编排部署EFK日志收集系统
云原生·容器·kubernetes
Jolen_xie6 小时前
Ubuntu下用Docker部署群晖系统---Virtual DSM --zerotier实现连接
linux·ubuntu·docker
深度学习真难7 小时前
docker启动kafka、zookeeper、kafdrop
docker·zookeeper·kafka
qq_172805598 小时前
Docker login 报证书存储错误的解决办法
docker·容器·证书
有来技术9 小时前
Linux 服务器安装 Docker - CentOS 9 (Stream)
linux·服务器·docker
生活百般滋味,人生需要笑对。 --佚名9 小时前
docker如何安装redis
redis·docker·容器
Karoku0669 小时前
【docker集群应用】Docker常用命令
运维·数据库·docker·容器
怡雪~11 小时前
K8s的水平自动扩容和缩容HPA
云原生·容器·kubernetes
史努比.11 小时前
HPA - k8s自动伸缩机制
云原生·容器·kubernetes