带有haproxy的兔子(docker stack)erlang cookie错误

时间:2018-09-30 07:35:23

标签: docker rabbitmq haproxy

嗨,我有一个包含Rabbitmq和haproxy的堆栈,当我使用docker-compose up时一切正常,但是当我使用docker stack deploy时,出现以下错误。

我该如何解决?

我在etrypoint.sh中尝试了以下操作,但不起作用:

rabbitmqctl status --erlang-cookie `cat $HOME/.erlang.cookie`
cat /var/lib/rabbitmq/.erlang.cookie
echo `cat $HOME/.erlang.cookie` >> /var/lib/rabbitmq/.erlang.cookie


Warning: PID file not written; -detached was passed.
Status of node rabbit@rabbitmq3 ...
[{pid,432},
 {running_applications,[{sasl,"SASL  CXC 138 11","3.1.2"},
                        {stdlib,"ERTS  CXC 138 10","3.4.5"},
                        {kernel,"ERTS  CXC 138 10","5.4.3.2"}]},
 {os,{unix,linux}},
 {erlang_version,"Erlang/OTP 20 [erts-9.3.3.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:64] [hipe] [kernel-poll:true]\n"},
 {memory,[{connection_readers,0},
          {connection_writers,0},
          {connection_channels,0},
          {connection_other,0},
          {queue_procs,0},
          {queue_slave_procs,0},
          {plugins,0},
          {other_proc,24460232},
          {metrics,0},
          {mgmt_db,0},
          {mnesia,0},
          {other_ets,874544},
          {binary,105848},
          {msg_index,0},
          {code,5502720},
          {atom,331273},
          {other_system,17317207},
          {allocated_unused,12094512},
          {reserved_unallocated,1605632},
          {strategy,rss},
          {total,[{erlang,48591824},{rss,62291968},{allocated,60686336}]}]},
 {alarms,[]},
 {listeners,[]},
 {vm_memory_calculation_strategy,rss},
 {processes,[{limit,1048576},{used,41}]},
 {run_queue,0},
 {uptime,1},
 {kernel,{net_ticktime,60}}]
MYJOEXMYGCHAKDWRCMYWStopping rabbit application on node rabbit@rabbitmq3 ...
Error: unable to perform an operation on node 'rabbit@rabbitmq3'. Please see diagnostics information and suggestions below.

Most common reasons for this are:

 * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
 * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
 * Target node is not running

In addition to the diagnostics info below:

 * See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more
 * Consult server logs on node rabbit@rabbitmq3

DIAGNOSTICS
===========

attempted to contact: [rabbit@rabbitmq3]

rabbit@rabbitmq3:
  * connected to epmd (port 4369) on rabbitmq3
  * epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
  * TCP connection succeeded but Erlang distribution failed

  * Authentication failed (rejected by the remote node), please check the Erlang cookie


Current node details:
 * node name: rabbitmqcli22@rabbitmq3
 * effective user's home directory: /var/lib/rabbitmq
 * Erlang cookie hash: 1B2M2Y8AsgTpgAmY7PhCfg==

我的ENV为

RABBITMQ_ERLANG_COOKIE=12345

并在docker compos中将其传递给ass env:

 rabbitmq2:
    image: rabbitmq:3-management
    hostname: rabbitmq2
    depends_on:
      - rabbitmq1
    environment:
      - RABBITMQ_ERLANG_COOKIE=${RABBITMQ_ERLANG_COOKIE}
    volumes:
      - ./cluster-entrypoint.sh:/usr/local/bin/cluster-entrypoint.sh
    entrypoint: /usr/local/bin/cluster-entrypoint.sh

使用这个天秤座https://github.com/pardahlman/docker-rabbitmq-cluster

0 个答案:

没有答案