如何在Windows上配置RabbitMQ群集

时间:2018-10-29 18:33:54

标签: rabbitmq

请,我需要您的帮助。

自上周以来,我一直在尝试在Windows服务器上配置RabbitMQ群集。我重新安装了RabbitMQ 3.7.8和ErlangOTP 21-1超过15次,试图找出问题并解决,但不幸的是,我所有的尝试都失败了。

我的环境: 带有操作系统的三个虚拟机:Windows Server 2012

环境变量设置:

•   ERLANG_HOME = C:\Program Files\erl10.1
•   path: C:\Program Files\Handle
•   %RABBITMQ_BASE% = c:\RabbitMQ
•   %RABBITMQ_CONFIG_FILE% = %RABBITMQ_BASE%
•   RABBITMQ_NODENAME = masternode
•   Server names: RabbitMQ01 “masternode” , RabbitMQ02, RabbitMQ03
•   Adding IP & hots name “masternode” in the host file for name resolution (C:\Windows\System32\drivers\etc\hosts)
•   Setting RabbitMQ configuration file “advanced.config” in c:\users\USERNAME\AppData\Roaming\RabbitMQ” to enable users to login to RabbitMQ management remotely by adding the following setting
[
{rabbit,
  [
   {tcp_listeners, [5672]},
   {loopback_users, []},

   {num_tcp_acceptors, 100}
  ]
  }
].

安装步骤:(针对每台服务器)

1. After setting the environment variables, I restarted the machine. Then
2. Install ErlangOTP 21-1
3. Install RabbitMQ 3.7.8 server
4. Enable plugins - rabbitmq-plugins.bat enable rabbitmq_management 

完成上述服务器的安装后,我开始配置集群

  1. 首先,我通过ping Rabbit @ masternode验证了RabbitMQ02,02可以访问masternode,并且成功。
  2. 使用以下命令停止RabbitMQ服务器和App

    rabbitmq服务停止 rabbitmqctl stop_app

    1. 将.erlang.cookie从主节点“ path = c:\ windows \ system32 \ config \ systemprofile”复制到RabbitMQ02“ path = c:\ windows \ system32 \ config \ systemprofile”和“ path = c:\ users \ USERNAME” ”。
  3. 通过执行以下命令启动RabbitMQ服务和应用

rabbitmqctl start_app rabbitmq-服务启动

  1. 通过执行此命令“ rabbitmqctl stop_app”再次停止应用
  2. 我开始将RabbitMQ02加入主节点  rabbitmqctl join_cluster rabbit@masternode(小写)

一旦达到这一点,我在RabbitMQ02上就会收到以下错误消息。

C:\ Program Files \ RabbitMQ Server \ rabbitmq_server-3.7.8 \ sbin> rabbitmqctl join_cluster rabbit @ masternode 错误:无法在节点“ rabbit @ rhrabbitmq02”上执行操作。请参阅 诊断信息和建议如下。

最常见的原因是:

  • 目标节点不可访问(例如,由于主机名解析,TCP连接o r防火墙问题)
  • CLI工具无法通过服务器进行身份验证(例如,由于CLI工具的Erlang) Cookie与服务器不匹配)
  • 目标节点未运行

除了下面的诊断信息:

  • 请参阅http://rabbitmq.com/document上的CLI,群集和联网指南 ation.html了解更多信息
  • 咨询服务器登录节点Rabbit @ rhrabbitmq02

诊断

试图联系:[rabbit @ rhrabbitmq02]

rabbit @ rhrabbitmq02:   *连接到rhrabbitmq02上的epmd(端口4369)   * epmd报告节点“兔子”使用端口25672进行节点间和CLI工具流量 我知道了   * TCP连接成功,但Erlang分发失败

  • 身份验证失败(被远程节点拒绝),请检查Erlang Cookie

当前节点详细信息:  *节点名称:rabbitmqcli41 @ rhrabbitmq02  *有效用户的主目录:C:\ Users \ admin  * Erlang Cookie哈希:pndBksvQokXyiSqBdnne / g ==

主节点状态:

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.8\sbin>rabbitmqctl status
Status of node masternode@rhrabbitmq01 ...
[{pid,4008},
 {running_applications,
     [{rabbitmq_management,"RabbitMQ Management Console","3.7.8"},
      {rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.8"},
      {rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.8"},
      {rabbit,"RabbitMQ","3.7.8"},
      {amqp_client,"RabbitMQ AMQP Client","3.7.8"},
      {rabbit_common,
          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
          "3.7.8"},
      {os_mon,"CPO  CXC 138 46","2.4.6"},
      {cowboy,"Small, fast, modern HTTP server.","2.2.2"},
      {mnesia,"MNESIA  CXC 138 12","4.15.5"},
      {cowlib,"Support library for manipulating Web protocols.","2.1.0"},
      {lager,"Erlang logging framework","3.6.3"},
      {syslog,"An RFC 3164 and RFC 5424 compliant logging framework.","3.4.3"},
      {ranch_proxy_protocol,"Ranch Proxy Protocol Transport","1.5.0"},
      {jsx,"a streaming, evented json parsing toolkit","2.8.2"},
      {ranch,"Socket acceptor pool for TCP protocols.","1.5.0"},
      {ssl,"Erlang/OTP SSL application","9.0.2"},
      {public_key,"Public key infrastructure","1.6.2"},
      {asn1,"The Erlang ASN1 compiler version 5.0.7","5.0.7"},
      {inets,"INETS  CXC 138 49","7.0.2"},
      {xmerl,"XML parser","1.3.18"},
      {recon,"Diagnostic tools for production use","2.3.2"},
      {crypto,"CRYPTO","4.3.3"},
      {goldrush,"Erlang event stream processor","0.1.9"},
      {compiler,"ERTS  CXC 138 10","7.2.5"},
      {syntax_tools,"Syntax tools","2.1.6"},
      {sasl,"SASL  CXC 138 11","3.2.1"},
      {stdlib,"ERTS  CXC 138 10","3.6"},
      {kernel,"ERTS  CXC 138 10","6.1"}]},
 {os,{win32,nt}},
 {erlang_version,
     "Erlang/OTP 21 [erts-10.1] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:64
]\n"},
 {memory,
     [{connection_readers,0},
      {connection_writers,0},
      {connection_channels,0},
      {connection_other,29212},
      {queue_procs,0},
      {queue_slave_procs,0},
      {plugins,1192744},
      {other_proc,26188552},
      {metrics,195524},
      {mgmt_db,337648},
      {mnesia,75088},
      {other_ets,2748464},
      {binary,181696},
      {msg_index,27840},
      {code,27573597},
      {atom,1131721},
      {other_system,9846202},
      {allocated_unused,9377056},
      {reserved_unallocated,0},
      {strategy,rss},
      {total,[{erlang,69528288},{rss,78905344},{allocated,78905344}]}]},
 {alarms,[]},
 {listeners,
     [{clustering,25672,"::"},
      {amqp,5672,"::"},
      {amqp,5672,"0.0.0.0"},
      {http,15672,"::"},
      {http,15672,"0.0.0.0"}]},
 {vm_memory_calculation_strategy,rss},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,3435785420},
 {disk_free_limit,50000000},
 {disk_free,86038073344},
 {file_descriptors,
     [{total_limit,8092},
      {total_used,2},
      {sockets_limit,7280},
      {sockets_used,0}]},
 {processes,[{limit,1048576},{used,399}]},
 {run_queue,1},
 {uptime,6087},
 {kernel,{net_ticktime,60}}]

1 个答案:

答案 0 :(得分:0)

问题解决方案:错误地将RABBITMQ_NODENAME设置为“ masternode”而不是“ rabbit @ masternode”,命令执行顺序中发生的错误是要执行的关键操作(在加入集群时-首先stop_app,然后服务停止),并在更改后重新启动服务配置,而不是重新安装rabbitmq服务。

如果愿意,可以根据我的设置场景在Windows上安装,配置Rabbitmq和配置群集,共享所有步骤的详细信息。最好的问候。