将外部IP地址绑定到Rabbit MQ服务器

发布于 2024-11-30 20:09:13 字数 1766 浏览 1 评论 0原文

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

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

因此,只要所有这些都在盒子 A 上,并且我以默认值启动 Rabbit MQ 服务器效果很好。

默认值是端口 5672 上的主机 = 127.0.0.1,但是 当我从盒子 BI 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 没问题,我可以从盒子 B ssh 到盒子 A

所以我假设我需要更改 ip RabbitMQ服务器使用 我发现了这个: 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

请帮忙

I have box A and it has a consumer on it that listens on a Rabbit MQ server

I have box B that will publish a message to the listener

So as long as all of this in on box A and I start Rabbit MQ server w/ defaults it works fine.

The defaults are host=127.0.0.1 on port 5672, but
when I telnet box.a.ip.addy 5672 from box B I get:

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

telnet on port 22 is fine, I can ssh into Box A from Box B

So I assume I need to change the ip that the RabbitMQ server uses
I found this: http://www.rabbitmq.com/configure.html and I now have a config file in the location the documentation said to use, with the name rabbitmq.config and it contains:

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

So I stopped the server, and started RabbitMQ server again. It failed. Here are the errors from the error logs. It's a little over my head. (in fact most of this is)

=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

and here is some more from the start up log:

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

Please help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

べ繥欢鉨o。 2024-12-07 20:09:13

你尝试添加吗?

RABBITMQ_NODE_IP_ADDRESS=box.a.ip.addy

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

根据 http://www.rabbitmq.com/configure.html#customise- General-unix-environment

另外,根据本文档,它指出默认值是绑定到所有接口。也许您的系统中已经设置了配置设置或环境变量,以将服务器限制为本地主机,从而覆盖您所做的任何其他操作。

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

did you try adding?

RABBITMQ_NODE_IP_ADDRESS=box.a.ip.addy

to the /etc/rabbitmq/rabbitmq.conf file?

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

Also per this documentation it states that the default is to bind to all interfaces. Perhaps there is a configuration setting or environment variable already set in your system to restrict the server to localhost overriding anything else you do.

UPDATE: After reading again I realize that the telnet should have returned "Connection Refused" not "No route to host." I would also check to see if you are having a firewall related issue.

夏了南城 2024-12-07 20:09:13

您需要在防火墙上打开 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

You need to open up the tcp port on your firewall

Using Linux, Find the iptables config file:

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

Edit the file:

sudo vi /etc/sysconfig/iptables

Fix the file by adding a port:

# 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文