【问题标题】:Binding external IP address to Rabbit MQ server将外部 IP 地址绑定到 Rabbit MQ 服务器
【发布时间】:2011-11-02 08:11:28
【问题描述】:

我有盒子 A,它上面有一个在 Rabbit MQ 服务器上侦听的消费者

我有盒子 B,它将向侦听器发布消息

所以只要所有这些都在框 A 上,我启动 Rabbit MQ 服务器 w/默认它就可以正常工作。

端口 5672 上的默认值为 host=127.0.0.1,但 当我从框 B 中 telnet box.a.ip.addy 5672 时,我得到:

Trying  box.a.ip.addy...
telnet: connect to address  box.a.ip.addy: No route to host
telnet: Unable to connect to remote host: No route to host

22 端口上的 telnet 很好,我可以从 Box B SSH 到 Box A

所以我假设我需要更改 RabbitMQ 服务器使用的 ip 我发现了这个:http://www.rabbitmq.com/configure.html,我现在在文档说要使用的位置有一个配置文件,名称是 rabbitmq.config,它包含:

[
    {rabbit, [{tcp_listeners, {"box.a.ip.addy", 5672}}]}
].

所以我停止了服务器,并再次启动了 RabbitMQ 服务器。它失败了。以下是错误日志中的错误。这有点过头了。 (事实上​​大部分是)

=ERROR REPORT==== 23-Aug-2011::14:49:36 ===
FAILED
Reason: {{case_clause,{{"box.a.ip.addy",5672}}},
         [{rabbit_networking,'-boot_tcp/0-lc$^0/1-0-',1},
          {rabbit_networking,boot_tcp,0},
          {rabbit_networking,boot,0},
          {rabbit,'-run_boot_step/1-lc$^1/1-1-',1},
          {rabbit,run_boot_step,1},
          {rabbit,'-start/2-lc$^0/1-0-',1},
          {rabbit,start,2},
          {application_master,start_it_old,4}]}

=INFO REPORT==== 23-Aug-2011::14:49:37 ===
    application: rabbit
    exited: {bad_return,{{rabbit,start,[normal,[]]},
                         {'EXIT',{rabbit,failure_during_boot}}}}
    type: permanent

下面是启动日志中的更多内容:

Erlang has closed
Error: {node_start_failed,normal}
^M
Crash dump was written to: erl_crash.dump^M
Kernel pid terminated (application_controller) ({application_start_failure,rabbit,{bad_return,{{rabbit,start,[normal,[]]},{'EXIT',{rabbit,failure_during_boot}}}}})^M

请帮忙

【问题讨论】:

  • 只是为了掩盖显而易见的问题:当您从框 B 成功 ssh 时,您使用 box.a.ip.addy 吗?
  • smh 不,我不想透露我的 IP 地址

标签: ip rabbitmq


【解决方案1】:

您是否尝试添加?

RABBITMQ_NODE_IP_ADDRESS=box.a.ip.addy

到 /etc/rabbitmq/rabbitmq.conf 文件?

http://www.rabbitmq.com/configure.html#customise-general-unix-environment

此外,根据本文档,它声明默认绑定到所有接口。也许您的系统中已经设置了配置设置或环境变量,以将服务器限制为 localhost 覆盖您所做的任何其他操作。

更新: 再次阅读后,我意识到 telnet 应该返回“拒绝连接”而不是“没有到主机的路由”。我还会检查您是否遇到与防火墙相关的问题。

【讨论】:

  • 这是一个与防火墙相关的问题,iptables 只允许端口 22,谢谢 :D
【解决方案2】:

您需要在防火墙上打开 tcp 端口

使用 Linux,找到 iptables 配置文件:

eric@dev ~$ find / -name "iptables" 2>/dev/null
/etc/sysconfig/iptables

编辑文件:

sudo vi /etc/sysconfig/iptables

通过添加端口来修复文件:

# Generated by iptables-save v1.4.7 on Thu Jan 16 16:43:13 2014
*filter
-A INPUT -p tcp -m tcp --dport 15672 -j ACCEPT
COMMIT

【讨论】:

  • 或者您可以更改管理配置 [{rabbitmq_management, [{listener, [{port, 15672}, {ip, "127.0.0.1"} ]} ]} ]。
猜你喜欢
  • 2016-08-26
  • 1970-01-01
  • 1970-01-01
  • 2014-05-31
  • 2010-11-08
  • 1970-01-01
  • 1970-01-01
  • 2021-01-20
  • 2020-01-31
相关资源
最近更新 更多