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
相关推荐
MonkeyKing_sunyuhua33 分钟前
ubuntu22.04 docker-compose安装postgresql数据库
数据库·docker·postgresql
追风林1 小时前
mac m1 docker本地部署canal 监听mysql的binglog日志
java·docker·mac
€☞扫地僧☜€2 小时前
docker 拉取MySQL8.0镜像以及安装
运维·数据库·docker·容器
茶馆大橘2 小时前
微服务系列六:分布式事务与seata
分布式·docker·微服务·nacos·seata·springcloud
全能全知者3 小时前
docker快速安装与配置mongoDB
mongodb·docker·容器
阿尔帕兹5 小时前
构建 HTTP 服务端与 Docker 镜像:从开发到测试
网络协议·http·docker
ZHOU西口7 小时前
微服务实战系列之玩转Docker(十八)
分布式·docker·云原生·架构·数据安全·etcd·rbac
景天科技苑9 小时前
【云原生开发】K8S多集群资源管理平台架构设计
云原生·容器·kubernetes·k8s·云原生开发·k8s管理系统
wclass-zhengge10 小时前
K8S篇(基本介绍)
云原生·容器·kubernetes
颜淡慕潇10 小时前
【K8S问题系列 |1 】Kubernetes 中 NodePort 类型的 Service 无法访问【已解决】
后端·云原生·容器·kubernetes·问题解决