[rabbitmq-discuss] Can't create queues

Steve steve at dnsbed.com
Fri Mar 1 02:06:14 GMT 2013


于 2013-2-28 18:10, Emile Joubert 写道:
> Have you checked the logfile? I assume you copied the code from the
> tutorials. Do the original versions run correctly, and can you see the
> queues while they run?

Hi Emile,

The rabbitmq port 5672 on localhost is a HAProxy, there are two real 
rabbitmq servers behind HAProxy on other hosts.

This is the sending script:

require "rubygems"
require "amqp"

AMQP.start(:host => "localhost") do |connection|
   channel  = AMQP::Channel.new(connection)
   exchange = channel.fanout("logs")
   message  =  "info: Hello World!"
   i = 0

   while true
       exchange.publish(message)
       puts " [x] Sent #{message} #{i}"
       i+=1
       sleep 1
   end
end


And the receiving script is the one I have posted.

require "rubygems"
require "amqp"

while true
   begin
     AMQP.start(:host => "localhost") do |connection|
       channel  = AMQP::Channel.new(connection)
       exchange = channel.fanout("logs", :durable => true)
       queue    = channel.queue("test_logs", :durable => true)
       queue.bind(exchange)

       puts " [*] Waiting for logs."

       queue.subscribe do |body|
         puts " [x] #{body}"
       end
     end

   rescue Exception => e
     puts e.message
   end
end


I didn't see queues were created on rabbitmq servers, and I checked the 
log, it says nothing but the HAproxy connection info:


=INFO REPORT==== 1-Mar-2013::10:00:41 ===
accepting AMQP connection <0.9170.4> (58.215.191.*:45615 -> 
58.215.191.*:5672)

=WARNING REPORT==== 1-Mar-2013::10:00:41 ===
closing AMQP connection <0.9170.4> (58.215.191.*:45615 -> 
58.215.191.*:5672):
connection_closed_abruptly



This is the rabbitmq status:

# rabbitmqctl status
Status of node rabbit at rabbit65 ...
[{pid,7404},
  {running_applications,[{rabbit,"RabbitMQ","3.0.2"},
                         {os_mon,"CPO  CXC 138 46","2.2.4"},
                         {mnesia,"MNESIA  CXC 138 12","4.4.12"},
                         {sasl,"SASL  CXC 138 11","2.1.8"},
                         {stdlib,"ERTS  CXC 138 10","1.16.4"},
                         {kernel,"ERTS  CXC 138 10","2.13.4"}]},
  {os,{unix,linux}},
  {erlang_version,"Erlang R13B03 (erts-5.7.4) [source] [64-bit] 
[smp:8:8] [rq:8] [async-threads:30] [hipe] [kernel-poll:true]\n"},
  {memory,[{total,62813800},
           {connection_procs,24608},
           {queue_procs,5568},
           {plugins,0},
           {other_proc,9246520},
           {mnesia,63512},
           {mgmt_db,0},
           {msg_index,24576},
           {other_ets,787400},
           {binary,66928},
           {code,12360466},
           {atom,1189649},
           {other_system,39044573}]},
  {vm_memory_high_watermark,0.4},
  {vm_memory_limit,6742995763},
  {disk_free_limit,1000000000},
  {disk_free,13672947712},
  {file_descriptors,[{total_limit,65435},
                     {total_used,3},
                     {sockets_limit,58889},
                     {sockets_used,1}]},
  {processes,[{limit,1048576},{used,131}]},
  {run_queue,0},
  {uptime,68579}]
...done.


Can you give future helps? Thanks.

Regards.


More information about the rabbitmq-discuss mailing list