RabbitMQ 3.5.6无法与任何已配置的主机建立TCP连接(Bunny :: TCPConnectionFailedForAllHosts)

时间:2015-12-08 08:46:53

标签: ruby-on-rails rabbitmq bunny

我正在尝试连接RabbitMQ服务器,但总是遇到这些错误:

W, [2015-12-08T15:38:01.993251 #37405]  WARN -- #<Bunny::Session:0x7fe07b894f78 guest@localhost:5672, vhost=/dev_prod, addresses=[localhost:5672]>: An empty frame was received while opening the connection. In RabbitMQ <= 3.1 this could mean an authentication issue.

并且

.../.rvm/gems/ruby-2.1.2/gems/bunny-2.2.0/lib/bunny/session.rb:315:in `rescue in start': Could not establish TCP connection to any of the configured hosts (Bunny::TCPConnectionFailedForAllHosts)

我在MAC OS上使用Ruby 2.1.2,RabbitMQ 3.5.6。 对不起,我是RabbitMQ的新手,只是试图使用它,但无法处理这个问题。 请给我一些建议。

1 个答案:

答案 0 :(得分:0)

这可能是因为你要么没有传递用户名和密码,要么传递错误的。

默认值为guest和guest,用户名和密码。

尝试初始化连接,如下所示:

 conn = Bunny.new(host:  'localhost',
                  port:  '5672',
                  vhost: '/',
                  user:  'guest',
                  pass:  'guest')
 conn.start

看看会发生什么