RabbitMQ Docker容器无法在AWS EC2实例上运行

时间:2017-12-05 13:45:41

标签: docker amazon-ec2 rabbitmq

我有一个运行的RabbitMQ docker容器,由PHP AMQ Library和Docker组合使用。

在笔记本电脑上本地运行时,一切正常,RabbitMQ可以接受请求。

但是,当部署到t2.medium实例进行测试时,RabbitMQ容器会每隔40-50秒重新启动并崩溃。

更糟糕的是,我无法在EC2实例中找到erl_crash.dump文件。

   Crash dump is being written to: erl_crash.dump...
              RabbitMQ 3.6.14. Copyright (C) 2007-2017 Pivotal Software, Inc.
  ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
  ##  ##
  ##########  Logs: tty
  ######  ##        tty
  ##########
              Starting broker...

=INFO REPORT==== 5-Dec-2017::13:49:05 ===
Starting RabbitMQ 3.6.14 on Erlang 19.2.1
Copyright (C) 2007-2017 Pivotal Software, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

=INFO REPORT==== 5-Dec-2017::13:49:05 ===
node           : rabbit@bbee863f0066
home dir       : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/rabbitmq.config
cookie hash    : o9UBS7q82y5P84WzdKnCaw==
log            : tty
sasl log       : tty
database dir   : /var/lib/rabbitmq/mnesia/rabbit@bbee863f0066
erl_child_setup closed

Crash dump is being written to: erl_crash.dump...erl_child_setup closed

              RabbitMQ 3.6.14. Copyright (C) 2007-2017 Pivotal Software, Inc.
  ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
  ##  ##
  ##########  Logs: tty
  ######  ##        tty
  ##########
              Starting broker...

=INFO REPORT==== 5-Dec-2017::13:49:13 ===
Starting RabbitMQ 3.6.14 on Erlang 19.2.1
Copyright (C) 2007-2017 Pivotal Software, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

=INFO REPORT==== 5-Dec-2017::13:49:13 ===
node           : rabbit@bbee863f0066
home dir       : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/rabbitmq.config
cookie hash    : o9UBS7q82y5P84WzdKnCaw==
log            : tty
sasl log       : tty
database dir   : /var/lib/rabbitmq/mnesia/rabbit@bbee863f0066

=ERROR REPORT==== 5-Dec-2017::13:49:15 ===
Loading of /usr/lib/erlang/lib/stdlib-3.2/ebin/dets_v9.beam failed: badfile
WARNING: module dets_v9 not found, so not scanned for boot steps.

=ERROR REPORT==== 5-Dec-2017::13:49:15 ===
beam/beam_load.c(1179): Error loading module dets_v9:
  form size 113612 greater than size 82440 of binary

erl_child_setup closed

Crash dump is being written to: erl_crash.dump...erl_child_setup closed

Crash dump is being written to: erl_crash.dump...
              RabbitMQ 3.6.14. Copyright (C) 2007-2017 Pivotal Software, Inc.
  ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
  ##  ##
  ##########  Logs: tty
  ######  ##        tty
  ##########
              Starting broker...

=INFO REPORT==== 5-Dec-2017::13:49:05 ===
Starting RabbitMQ 3.6.14 on Erlang 19.2.1
Copyright (C) 2007-2017 Pivotal Software, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

=INFO REPORT==== 5-Dec-2017::13:49:05 ===
node           : rabbit@bbee863f0066
home dir       : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/rabbitmq.config
cookie hash    : o9UBS7q82y5P84WzdKnCaw==
log            : tty
sasl log       : tty
database dir   : /var/lib/rabbitmq/mnesia/rabbit@bbee863f0066
erl_child_setup closed

Crash dump is being written to: erl_crash.dump...erl_child_setup closed

              RabbitMQ 3.6.14. Copyright (C) 2007-2017 Pivotal Software, Inc.
  ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
  ##  ##
  ##########  Logs: tty
  ######  ##        tty
  ##########
              Starting broker...

=INFO REPORT==== 5-Dec-2017::13:49:13 ===
Starting RabbitMQ 3.6.14 on Erlang 19.2.1
Copyright (C) 2007-2017 Pivotal Software, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

=INFO REPORT==== 5-Dec-2017::13:49:13 ===
node           : rabbit@bbee863f0066
home dir       : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/rabbitmq.config
cookie hash    : o9UBS7q82y5P84WzdKnCaw==
log            : tty
sasl log       : tty
database dir   : /var/lib/rabbitmq/mnesia/rabbit@bbee863f0066

=ERROR REPORT==== 5-Dec-2017::13:49:15 ===
Loading of /usr/lib/erlang/lib/stdlib-3.2/ebin/dets_v9.beam failed: badfile
WARNING: module dets_v9 not found, so not scanned for boot steps.

=ERROR REPORT==== 5-Dec-2017::13:49:15 ===
beam/beam_load.c(1179): Error loading module dets_v9:
  form size 113612 greater than size 82440 of binary

erl_child_setup closed

Crash dump is being written to: erl_crash.dump...erl_child_setup closed

              RabbitMQ 3.6.14. Copyright (C) 2007-2017 Pivotal Software, Inc.
  ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
  ##  ##
  ##########  Logs: tty
  ######  ##        tty
  ##########
              Starting broker...

=INFO REPORT==== 5-Dec-2017::13:49:22 ===
Starting RabbitMQ 3.6.14 on Erlang 19.2.1
Copyright (C) 2007-2017 Pivotal Software, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

=INFO REPORT==== 5-Dec-2017::13:49:22 ===
node           : rabbit@bbee863f0066
home dir       : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/rabbitmq.config
cookie hash    : o9UBS7q82y5P84WzdKnCaw==
log            : tty
sasl log       : tty
database dir   : /var/lib/rabbitmq/mnesia/rabbit@bbee863f0066
erl_child_setup closed

Crash dump is being written to: erl_crash.dump...erl_child_setup closed

              RabbitMQ 3.6.14. Copyright (C) 2007-2017 Pivotal Software, Inc.
  ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
  ##  ##
  ##########  Logs: tty
  ######  ##        tty
  ##########
              Starting broker...

=INFO REPORT==== 5-Dec-2017::13:49:32 ===
Starting RabbitMQ 3.6.14 on Erlang 19.2.1
Copyright (C) 2007-2017 Pivotal Software, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

这是Rabbit的docker撰写文件:

rabbit:
    mem_limit: 80000000
    build: 'support/rabbitmq'
    environment:
        - RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}
        - RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
        - RABBITMQ_VM_MEMORY_HIGH_WATERMARK=800MB
    ports:
        - "15672:15672"
        - "5672:5672"
    restart: unless-stopped

为什么它不起作用,或者我如何获得这个转储文件?

1 个答案:

答案 0 :(得分:1)

问题是由于docker-compose mem-limit设置错误

    mem_limit: 80000000

此设置为80mb,这对于RabbitMQ正确初始化是不够的。

删除它并让docker_compose管理容器内存是解决方案。