docker-compose部署rocketmq

如果你不相信努力和时光,那么成果就会是第一个选择辜负你的。不要去否定你自己的过去,也不要用你的过去牵扯你现在的努力和对未来的展望。不是因为拥有希望你才去努力,而是去努力了,你才有可能看到希望的光芒。docker-compose部署rocketmq,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com,来源:原文

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=<主机IP>
namesrvAddr=<主机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
    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

 

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/200009.html

(0)
小半的头像小半

相关推荐

极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!