2014-01-17 27 views
2

我成功地从我的虚拟机(runnung Ubuntu)上的rabbitmq-c库运行了一个示例。现在,当我尝试在另一台设备(比如设备2)上运行示例时,该设备试图侦听由我的虚拟机(在虚拟机上运行兔子服务器)发送的消息时,出现以下错误:Rabbitmq听众没有连接到另一台机器

$ ./amqp_listen VM_IP_address 5672 amq.direct test
$ Logging in: connection closed unexpectedly

这是在amqp_listen.c下列运算的结果:

die_on_amqp_error(amqp_login(conn, "/", 0, 131072, 0, AMQP_SASL_METHOD_PLAIN, "guest", "guest"), 
        "Logging in"); 

我注意到,如果我运行设备2此命令,我看到这条消息:

$ telnet VM_IP_address 5672
$ Connection closed by foreign host

我不是专家,但我想必须有一些网络配置设置阻止Ubuntu VM接受传入连接。但我不确定问题是什么。

+0

您错过了telnet行的ip地址。如果你添加它,你会得到同样的错误? – ldx

+0

是的,同样的错误。更新问题。 – Bob

+0

你使用什么样的虚拟机?网络设置? – ldx

回答

0

我只是无意中发现了这个问题,我认为这是一个古老的一个,但我给它一个去:)
报价rabbitmq docs

"guest" user can only connect via localhost By default, the guest user is prohibited from connecting to the broker remotely; it can only connect over a loopback interface (i.e. localhost).


以及如何使其工作:

If you wish to allow the guest user to connect from a remote host, you should set the loopback_users configuration item to []. A complete rabbitmq.config which does this would look like:

[{rabbit, [{loopback_users, []}]}].

相关问题