can't connect to rabbit mq with ruby gem carrot

478 views Asked by At

I am trying to connect to my rabbitmq server. I am using

require 'carrot'
@client = Carrot.new(:host => 10.xx.xx.xx, :port => 5672)
q = @client.queue("my_queue")

I am getting this error

"#<Carrot::AMQP::Server::ServerDown: Connection reset by peer>"

How do I check if my server is down? and how do I restart it?

rabbitmq-server
1

There are 1 answers

0
Andy Piper On BEST ANSWER

Can you help us to help you with some additional info?

  • What version of Ruby?
  • What version of RabbitMQ?
  • Where is your RabbitMQ broker running?
  • Do you have any kind of firewall preventing you from connecting to the RabbitMQ broker port?
  • Do you know whetherany security is enabled?

If you have access to the command line of the server where the broker is running, you should be able to see an Erlang process if you execute ps -ef | grep rabbitmq

To start the broker, run

rabbitmq-server

I am able to run your code OK against RabbitMQ 3.0.1 running on my local machine with latest Ruby and Carrot gem, the only correction was that the host IP address needed to be enclosed in double quotes.