0

I want build a rocketmq cluster on my machine, where the mode is master-slave, with docker-compose

And I can only start one broker at the same time. That say when I start master, slave exits. The opposite is also, can some body help?

Here is my 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

slave broker conf

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

brokerRole = SLAVE
flushDiskType = ASYNC_FLUSH

slave broker conf

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

when broker slave starts, the master writes the log and exits;

========log=======

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',
...
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Smisi David
  • 57
  • 1
  • 9
  • Do you have some logs of the stopped containers? `docker ps -a` will show all container. With `docker logs ` will show logs of a specific container. – Mathias Sep 18 '19 at 16:47
  • @Mathias, I posted the log – Smisi David Sep 19 '19 at 14:33
  • Are you running docker within a vm? Does your vm have enogh RAM? (See here: https://www.petefreitag.com/item/848.cfm ) – Mathias Sep 19 '19 at 14:40
  • Why would you need two ports for broker? I have seen examples of 3 ports, ie, 11909, 11911, 11913... But their documentation has only one port (11911) so I am confused.. – Macindows Aug 14 '20 at 09:45

0 Answers0