在Docker下部署RocketMQ(二)-namesrv高可用

2018-06-05  本文已影响559人  do_young

方案

实现高可用主要三种模式,集群,主从,选举。
如果Docker与Swram或K8S等技术相结合的话可以使用集群模式。
namesrv本身不支持选举模式。
所以就只能通过双namesrv模式(是主从还是主方模式,本人其实也不是特别清楚,是同步热备还是异步热备更是不清楚了。只是在测试案例中,将一个namesrv服务停止以后,消息的生产及消费客户端都能正常工作,只是监控端有问题,这个待后面再深入分析一下。)

双namesrv

version: '2'
services:
  namesrv-m:
    image: going/rocketmq-namesrv:4.2.0
    ports:
      - 9876:9876
    volumes:
      - "E:/rocketmq/namesrv/master/logs:/opt/logs"
      - "E:/rocketmq/namesrv/master/store:/opt/store"
  namesrv-s:
    image: going/rocketmq-namesrv:4.2.0
    ports:
      - 9877:9876
    volumes:
      - "E:/rocketmq/namesrv/slave/logs:/opt/logs"
      - "E:/rocketmq/namesrv/slave/store:/opt/store"      

broker配置

 broker:
    image: going/rocketmq-broker:4.2.1
    ports:
      - 10909:10909
      - 10911:10911
    volumes:
      - "E:/rocketmq/broker/master-1/logs:/opt/logs"
      - "E:/rocketmq/broker/master-1/store:/opt/store"
    links:
      - namesrv-m:namesrv-m
      - namesrv-s:namesrv-s

监控配置

  console:
    image: styletang/rocketmq-console-ng:latest
    ports:
     - "8080:8080"
    links:
     - namesrv-m:namesrv-m
     - namesrv-s:namesrv-s
    environment:
     JAVA_OPTS: -Drocketmq.config.namesrvAddr=namesrv-m:9876;namesrv-s:9877 -Dcom.rocketmq.sendMessageWithVIPChannel=false

生产消息客户端配置

  producer:
    image: going/rocketmq-producer:4.1.1
    links:
     - namesrv-m:namesrv-m
     - namesrv-s:namesrv-s
  consumer:
    image: going/rocketmq-consumer:4.1.1
    links:
     - namesrv-m:namesrv-m
     - namesrv-s:namesrv-s 
上一篇下一篇

猜你喜欢

热点阅读