关于使用docker-compose构建robotmq集群的一些问题

时间:2019-09-18 16:32:34

标签: docker docker-compose rocketmq

我想在我的机器上构建一个robotmq集群,该模式是主从模式,由docker-compose组成

我只能同时启动一位经纪人。那就是说当我启动主机,从机退出时,相反的是,有些身体还能帮忙吗?

这是我的docker-compose.yml

version: '2'
services:
  namesrv:
    image: rocketmqinc/rocketmq:4.5.0-alpine
    ports:
      - 9876:9876
    volumes:
      - "/data/namesrv/master/logs:/opt/logs"
      - "/data/namesrv/master/store:/opt/store"
    environment:
      MAX_POSSIBLE_HEAP: 100000000
    command: sh mqnamesrv
  broker-a-m:
    image: rocketmqinc/rocketmq:4.5.0-alpine
    ports:
      - 10909:10909
      - 10911:10911
    volumes:
      - "/data/broker-a/logs:/opt/logs"
      - "/data/broker-a/store:/opt/store"
      - "/data/broker-a/conf:/opt/conf"
    links:
      - namesrv:namesrv
    environment:
      NAMESRV_ADDR: namesrv:9876
    command: sh mqbroker -c /opt/conf/broker.conf
  broker-a-s:
    image: rocketmqinc/rocketmq:4.5.0-alpine
    ports:
      - 11909:10909
      - 11911:10911
    volumes:
      - "/data/broker-a-slave/logs:/opt/logs"
      - "/data/broker-a-slave/store:/opt/store"
      - "/data/broker-a-slave/conf:/opt/conf"
    links:
      - namesrv:namesrv
    environment:
      NAMESRV_ADDR: namesrv:9876
    command: sh mqbroker -c /opt/conf/broker.conf

从属经纪人会议

brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 1
deleteWhen = 04
fileReservedTime = 48
listenPort = 10911

brokerRole = SLAVE
flushDiskType = ASYNC_FLUSH

从属经纪人会议

brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
listenPort = 10911
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH

当代理从属启动时,主服务器写入日志并退出;

========日志=======

broker-a-m_1  | The broker[broker-a, broker-a-m:10911] boot success. serializeType=JSON and name server is namesrv:9876
broker-a-m_1  | Killed
compose.cli.verbose_proxy.proxy_callable: docker wait <- ('4d69ef2838f4f719e9cbf43c7cfc6d79382d356ecba88b610278eea11b9d0bfd')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('4d69ef2838f4f719e9cbf43c7cfc6d79382d356ecba88b610278eea11b9d0bfd')
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.22/containers/4d69ef2838f4f719e9cbf43c7cfc6d79382d356ecba88b610278eea11b9d0bfd/wait HTTP/1.1" 200 32
compose.cli.verbose_proxy.proxy_callable: docker wait -> {'Error': None, 'StatusCode': 137}
rockermq_broker-a-m_1 exited with code 137
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/containers/4d69ef2838f4f719e9cbf43c7cfc6d79382d356ecba88b610278eea11b9d0bfd/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': ['mqbroker', '-c', '/opt/conf/broker.conf'],
 'Config': {'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['sh', 'mqbroker', '-c', '/opt/conf/broker.conf'],
            'Domainname': '',
            'Entrypoint': None,
            'Env': ['NAMESRV_ADDR=namesrv:9876',
                    'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin',
...

0 个答案:

没有答案