Rabbit-MQ version 3.2.1 command-line to unbind a queue from an exchange.

707 views
Skip to first unread message

AMS

unread,
May 26, 2015, 4:56:56 PM5/26/15
to rabbitm...@googlegroups.com
I've inherited an active RMQ installation (ver 3.2.1) and am looking for some information on how to unbind a queue from an exchange. 

One of the queues running is bound to an exchange, but it no longer is needed. It has no consumers of the data anymore, so this queue can be unbound and the data purged. 

I've got two questions (semi-related) on this machine.

#1) Can I issue a command via the cli that will unbind and then purge the data in this queue?

        Is there any command like:
          
          > sudo rabbitmqctl  ....

       which can do this?
           

#2) I cannot any longer attach to the RMQ UI (rabbitmq_management). I'm trying to find a way to bring the UI back. My original thought was:

       sudo rabbitmq-plugins disable rabbitmq_management

   followed by

      sudo rabbitmq-plugins enable rabbitmq_management

   However since this is version 3.2.1, and I've read you cannot do that without a restart until 3.4.0. ...

   Again, I've inherited the RMQ systems here, and the people that set-up managed these systems have move on, so I'm looking for resources to get up to speed on this system which keeping it running in a live environment.

Alan 

Michael Klishin

unread,
May 26, 2015, 7:17:42 PM5/26/15
to rabbitm...@googlegroups.com, AMS
On 26 May 2015 at 23:56:58, AMS (dever...@gmail.com) wrote:
> #1) Can I issue a command via the cli that will unbind and then
> purge the data in this queue?
>
> Is there any command like:
>
> > sudo rabbitmqctl ....
>
> which can do this?

rabbitmqadmin is probably what you want (part of the mgmt plugin)

You can also purge a queue first using any client you want,
some are very easy to use from a REPL (e.g. Bunny or Python ones). 

> #2) I cannot any longer attach to the RMQ UI (rabbitmq_management).
> I'm trying to find a way to bring the UI back.

That's not how you fix things. See what's going on in the log and
tools such as iostat and vmstat.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


AMS

unread,
May 27, 2015, 4:44:51 PM5/27/15
to rabbitm...@googlegroups.com, dever...@gmail.com


> #1) Can I issue a command via the cli that will unbind and then  
> purge the data in this queue?
>  
> Is there any command like:
>  
> > sudo rabbitmqctl ....
>  
> which can do this?

rabbitmqadmin is probably what you want (part of the mgmt plugin)

Thanks. I've been searching "rabbitmqadmin" commands and find something like:

sudo rabbitmqadmin -u {user} -p {password} -V / delete queue name={name}
 
but isn't that a moot point if rabbitmq_management plugin isn't running?

You can also purge a queue first using any client you want,
some are very easy to use from a REPL (e.g. Bunny or Python ones). 

> #2) I cannot any longer attach to the RMQ UI (rabbitmq_management).  
> I'm trying to find a way to bring the UI back.

That's not how you fix things. See what's going on in the log and
tools such as iostat and vmstat.

These machine have been running for over a year and it looks like (via netstat which I did earlier) that the UI has accumulated a bunch of CLOSE_WAIT TCP connections. I'm new to RMQ, so am open to suggestions on how to diagnose and fix this.  If we can get the rabbitmq_management UI back the CLI command won't be needed, since I would unbind via the interface.

Since this is 3.2.1 the disable/enable by itself doesn't seem to be enough. Can you restart the server without disrupting the queues?

Michael Klishin

unread,
May 27, 2015, 7:49:49 PM5/27/15
to AMS, rabbitm...@googlegroups.com

> On 27/5/2015, at 23:44, AMS <dever...@gmail.com> wrote:
>
> These machine have been running for over a year and it looks like (via netstat which I did earlier) that the UI has accumulated a bunch of CLOSE_WAIT TCP connections. I'm new to RMQ, so am open to suggestions on how to diagnose and fix this. If we can get the rabbitmq_management UI back the CLI command won't be needed, since I would unbind via the interface.

"Expired" connections should go away after a period of time (in minutes), until something opens new ones all the time, of course.

> Since this is 3.2.1 the disable/enable by itself doesn't seem to be enough. Can you restart the server without disrupting the queues?

Depends on how you define "disrupted". Client connections will be dropped but persistent messages in durable queues will still be around.

AMS

unread,
May 29, 2015, 4:53:14 PM5/29/15
to rabbitm...@googlegroups.com, dever...@gmail.com

> Depends on how you define "disrupted". Client connections will be dropped but persistent messages in durable queues will still be around.

Below is "rabbitmqctl report" with IPs obscured. This system needs to keep running and the admin UI isn't accessible, but I need to unbind and purge the "dynamo-history-2" queue which no longer has any consumers. What is the best course of action? 

----

Reporting server status on {{2015,5,29},{20,19,25}}

 ...
Status of node 'rabbit@ip-10-..—..53' ...
[{pid,1251},
 {running_applications,
     [{rabbitmq_management,"RabbitMQ Management Console","3.2.1"},
      {rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.2.1"},
      {webmachine,"webmachine","1.10.3-rmq3.2.1-gite9359c7"},
      {mochiweb,"MochiMedia Web Server","2.7.0-rmq3.2.1-git680dba8"},
      {rabbitmq_management_agent,"RabbitMQ Management Agent","3.2.1"},
      {rabbit,"RabbitMQ","3.2.1"},
      {os_mon,"CPO  CXC 138 46","2.2.12"},
      {inets,"INETS  CXC 138 49","5.9.5"},
      {mnesia,"MNESIA  CXC 138 12","4.9"},
      {amqp_client,"RabbitMQ AMQP Client","3.2.1"},
      {xmerl,"XML parser","1.3.3"},
      {ssl,"Erlang/OTP SSL application","5.3.1"},
      {public_key,"Public key infrastructure","0.19"},
      {crypto,"CRYPTO version 2","3.0"},
      {asn1,"The Erlang ASN1 compiler version 2.0.2","2.0.2"},
      {sasl,"SASL  CXC 138 11","2.3.2"},
      {stdlib,"ERTS  CXC 138 10","1.19.3"},
      {kernel,"ERTS  CXC 138 10","2.16.3"}]},
 {os,{unix,linux}},
 {erlang_version,
     "Erlang R16B02 (erts-5.10.3) [source-b44b726] [64-bit] [smp:4:4] [async-threads:30] [hipe] [kernel-poll:true]\n"},
 {memory,
     [{total,3966550384},
      {connection_procs,1780488},
      {queue_procs,16394008},
      {plugins,428024},
      {other_proc,13787272},
      {mnesia,74528},
      {mgmt_db,875152},
      {msg_index,3459759840},
      {other_ets,434386224},
      {binary,8134976},
      {code,21850359},
      {atom,2328889},
      {other_system,6750624}]},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,6283106713},
 {disk_free_limit,50000000},
 {disk_free,63282221056},
 {file_descriptors,
     [{total_limit,924},
      {total_used,16},
      {sockets_limit,829},
      {sockets_used,12}]},
 {processes,[{limit,1048576},{used,322}]},
 {run_queue,0},
 {uptime,30921791}]
Cluster status of node 'rabbit@ip-10-..-..-53' ...
[{nodes,[{disc,['rabbit@ip-10-..-..-53','rabbit@ip-10-..-..-186']}]},
 {running_nodes,['rabbit@ip-10-..-..-53']},
 {partitions,[]}]

Application environment of node 'rabbit@ip-10-..-..-53' ...
[{auth_backends,[rabbit_auth_backend_internal]},
 {auth_mechanisms,['PLAIN','AMQPLAIN']},
 {backing_queue_module,rabbit_variable_queue},
 {cluster_nodes,{[],disc}},
 {cluster_partition_handling,ignore},
 {collect_statistics,fine},
 {collect_statistics_interval,5000},
 {default_permissions,[<<".*">>,<<".*">>,<<".*">>]},
 {default_user,<<"guest">>},
 {default_user_tags,[administrator]},
 {default_vhost,<<"/">>},
 {delegate_count,16},
 {disk_free_limit,50000000},
 {enabled_plugins_file,"/etc/rabbitmq/enabled_plugins"},
 {error_logger,{file,"/var/log/rabbitmq/rabbit@ip-10-..-..-53.log"}},
 {frame_max,131072},
 {heartbeat,580},
 {hipe_compile,false},
 {hipe_modules,[rabbit_reader,rabbit_channel,gen_server2,rabbit_exchange,
                rabbit_command_assembler,rabbit_framing_amqp_0_9_1,
                rabbit_basic,rabbit_event,lists,queue,priority_queue,
                rabbit_router,rabbit_trace,rabbit_misc,rabbit_binary_parser,
                rabbit_exchange_type_direct,rabbit_guid,rabbit_net,
                rabbit_amqqueue_process,rabbit_variable_queue,
                rabbit_binary_generator,rabbit_writer,delegate,gb_sets,lqueue,
                sets,orddict,rabbit_amqqueue,rabbit_limiter,gb_trees,
                rabbit_queue_index,rabbit_exchange_decorator,gen,dict,ordsets,
                file_handle_cache,rabbit_msg_store,array,
                rabbit_msg_store_ets_index,rabbit_msg_file,
                rabbit_exchange_type_fanout,rabbit_exchange_type_topic,mnesia,
                mnesia_lib,rpc,mnesia_tm,qlc,sofs,proplists,credit_flow,pmon,
                ssl_connection,tls_connection,ssl_record,tls_record,gen_fsm,
                ssl]},
 {included_applications,[]},
 {log_levels,[{connection,info}]},
 {msg_store_file_size_limit,16777216},
 {msg_store_index_module,rabbit_msg_store_ets_index},
 {plugins_dir,"/usr/lib/rabbitmq/lib/rabbitmq_server-3.2.1/sbin/../plugins"},
 {plugins_expand_dir,"/rabbitmq/rabbit@ip-10-..-..-53-plugins-expand"},
 {queue_index_max_journal_entries,65536},
 {reverse_dns_lookups,false},
 {sasl_error_logger,{file,"/var/log/rabbitmq/rabbit@ip-10-..-..-53-sasl.log"}},
 {server_properties,[]},
 {ssl_apps,[asn1,crypto,public_key,ssl]},
 {ssl_cert_login_from,distinguished_name},
 {ssl_listeners,[5671]},
 {ssl_options,[{cacertfile,"/home/ubuntu/certstuff/testca/cacert.pem"},
               {certfile,"/home/ubuntu/certstuff/server/cert.pem"},
               {keyfile,"/home/ubuntu/certstuff/server/key.pem"},
               {verify,verify_peer},
               {fail_if_no_peer_cert,false}]},
 {tcp_listen_options,[binary,
                      {packet,raw},
                      {reuseaddr,true},
                      {backlog,128},
                      {nodelay,true},
                      {linger,{true,0}},
                      {exit_on_close,false}]},
 {tcp_listeners,[]},
 {trace_vhosts,[]},
 {vm_memory_high_watermark,0.4},
 {vm_memory_high_watermark_paging_ratio,0.5}]

Connections:
pid     name    port    peer_port       host    peer_host       ssl     peer_cert_subject       peer_cert_issuer        peer_cert_validity      auth_mechanism  ssl_protocol    ssl_key_excha
nge     ssl_cipher      ssl_hash        protocol        user    vhost   timeout frame_max       client_properties       recv_oct        recv_cnt        send_oct        send_cnt        send_
pend    state   last_blocked_by last_blocked_age        channels
<'rabbit@ip-10-..-..-53'.3.14152.3614> 10.-.-.194:38766 -> 10.-.-.53:5671        5671    38766   10.-.-.53    10.-.-.194   true                            PLAIN   tlsv1   rsa aes_128_cbc      sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabili
ties",[{"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]
},{"copyright","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.3"}]  173684  2452    88887   1177    0       running none    infinity        1
<'rabbit@ip-10-..-..-53'.3.12729.4234> 10.-.-.70:48940 -> 10.-.-.53:5671        5671    48940   10.-.-.53    10.-.-.70   true                            PLAIN   tlsv1   rsa aes_256_cbc      sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabili
ties",[{"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]
},{"copyright","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  4390418170      30595296        73404651757     48782379        0       running none    infinity        1
<'rabbit@ip-10-..-..-53'.3.3827.4513>  10.-.-.105:58265 -> 10.-.-.53:5671       5671    58265   10.-.-.53    10.-.-.105  true                            PLAIN   tlsv1   rsa aes_256_cbc      sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabili
ties",[{"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]
},{"copyright","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  3807188740      26082471        63639748060     42302063        0       running none    infinity        1
<'rabbit@ip-10-..-..-53'.3.25492.5833> 10.-.-.166:48153 -> 10.-.-.53:5671       5671    48153   10.-.-.53    10.-.-.166  true                            PLAIN   tlsv1   rsa aes_256_cbc      sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabili
ties",[{"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]
},{"copyright","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  4179975549      10438726        448696593       5471890 0       running none    infinity        0
<'rabbit@ip-10-..-..-53'.3.10131.6281> 10.-.-.166:53284 -> 10.-.-.53:5671       5671    53284   10.-.-.53    10.-.-.166  true                            PLAIN   tlsv1   rsa aes_256_cbc      sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabili
ties",[{"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]
},{"copyright","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  1527166672      3098424 146835897       1790662 0       running none    infinity        0
<'rabbit@ip-10-..-..-53'.3.10157.6281> 10.-.-.178:50601 -> 10.-.-.53:5671 5671    50601   10.-.-.53    10.-.-.178    true                            PLAIN   tlsv1   rsa     aes_2
56_cbc  sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabilities",[{
"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]},{"copy
right","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  1440473099      2973017 138353161       1687214 0       running none    infinity        0
<'rabbit@ip-10-..-..-53'.3.10667.6281> 10.-.-.201:46301 -> 10.-.-.53:5671        5671    46301   10.-.-.53    10.-.-.201   true                            PLAIN   tlsv1   rsa aes_256_cbc      sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabili
ties",[{"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]
},{"copyright","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  1438625981      2905863 138209825       1685466 0       running none    infinity        0
<'rabbit@ip-10-..-..-53'.3.11177.6281> 10.-.-.155:46132 -> 10.-.-.53:5671       5671    46132   10.-.-.53    10.-.-.155  true                            PLAIN   tlsv1   rsa aes_256_cbc      sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabili
ties",[{"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]
},{"copyright","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  1433082673      2861505 137658949       1678748 0       running none    infinity        0
<'rabbit@ip-10-..-..-53'.3.155.6344>   10.-.-.155:53686 -> 10.-.-.53:5671       5671    53686   10.-.-.53    10.-.-.155  true                            PLAIN   tlsv1   rsa -
aes_256_cbc     sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabili
ties",[{"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]
},{"copyright","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  1145070390      2580663 118998373       1451180 0       running none    infinity        0
<'rabbit@ip-10-..-..-53'.3.7396.6344>  10.-.-.81:49868 -> 10.-.-.53:5671        5671    49868   10.-.-.53    10.-.-.81   true                            PLAIN   tlsv1   rsa aes_256_cbc      sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabili
ties",[{"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]
},{"copyright","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  1212948930      2706270 126218637       1539232 0       running none    infinity        0
<'rabbit@ip-10-..-..-53'.3.15630.6344> 10.-.-.79:46875 -> 10.-.-.53:5671 5671    46875   10.-.-.53    10.-.-.79    true                            PLAIN   tlsv1   rsa     aes_2
56_cbc  sha     {0,9,1} rmqguy  /       580     131072  [{"product","RabbitMQ"},{"information","Licensed under the MPL. See http://www.rabbitmq.com/"},{"platform","Java"},{"capabilities",[{
"exchange_exchange_bindings",true},{"authentication_failure_close",true},{"consumer_cancel_notify",true},{"basic.nack",true},{"publisher_confirms",true},{"connection.blocked",true}]},{"copy
right","Copyright (C) 2007-2013 GoPivotal, Inc."},{"version","3.2.2"}]  1108861821      2466489 115435145       1407726 0       running none    infinity        0

Channels:
pid     name    connection      number  user    vhost   transactional   confirm consumer_count  messages_unacknowledged messages_unconfirmed    messages_uncommitted    acks_uncommitted    prefetch_count   client_flow_blocked
<'rabbit@ip-10-..-..-53'.3.15341.3614> 10.-.-.194:38766 -> 10.-.-.53:5671 (1)    <'rabbit@ip-10-..-..-53'.3.14152.3614> 1       rmqguy  /       false   false   1       0       0   00       10      false
<'rabbit@ip-10-..-..-53'.3.11819.4234> 10.-.-.70:48940 -> 10.-.-.53:5671 (1)    <'rabbit@-ip-10-..-..-53'.3.12729.4234> 1       rmqguy  /       false   false   1       10      0   00       100     false
<'rabbit@ip-10-..-..-53'.3.15546.4503> 10.-.-.105:58265 -> 10.-.-.53:5671 (1)   <'rabbit@ip-10-..-..-53'.3.3827.4513>  1       rmqguy  /       false   false   1       15      0   00       100     false

Queues on /:
pid     name    durable auto_delete     arguments       owner_pid       policy  exclusive_consumer_pid  exclusive_consumer_tag  messages_ready  messages_unacknowledged messages        consu
mers    memory  slave_pids      synchronised_slave_pids backing_queue_status    status
<'rabbit@ip-..-..-179-186'.3.4580.1919>        dynamohistory   false   false   []                                      0       0       0       0       22480                   [{q1,0}, {q2,
0}, {delta,{delta,undefined,0,undefined}}, {q3,0}, {q4,0}, {len,0}, {pending_acks,0}, {target_ram_count,infinity}, {ram_msg_count,0}, {ram_ack_count,0}, {next_seq_id,768485768}, {persistent
_count,0}, {avg_ingress_rate,0.0}, {avg_egress_rate,0.0}, {avg_ack_ingress_rate,0.0}, {avg_ack_egress_rate,0.0}]        running
<'rabbit@ip-10-..-..-53'.3.11672.4413> dynamo-history-2        false   false   []                                      28483139        0       28483139        0       16366136            [{q1,281}, {q2,11481}, {delta,{delta,18268160,28465280,46733440}}, {q3,4942}, {q4,1155}, {len,28483139}, {pending_acks,0}, {target_ram_count,1436}, {ram_msg_count,1436}, {ram_ack_co
unt,0}, {next_seq_id,46745202}, {persistent_count,0}, {avg_ingress_rate,202.85709890976545}, {avg_egress_rate,0.0}, {avg_ack_ingress_rate,0.0}, {avg_ack_egress_rate,0.0}]      running
<'rabbit@ip-10-..-..-186'.3.19537.4723>       dynamo-history  false   false   []                                      0       26      26      2       1805400                 [{q1,0}, {q2,
0}, {delta,{delta,undefined,0,undefined}}, {q3,0}, {q4,0}, {len,0}, {pending_acks,26}, {target_ram_count,infinity}, {ram_msg_count,0}, {ram_ack_count,26}, {next_seq_id,1110376467}, {persist
ent_count,0}, {avg_ingress_rate,490.03525014889993}, {avg_egress_rate,490.03525014889993}, {avg_ack_ingress_rate,490.03525014889993}, {avg_ack_egress_rate,488.3358214968128}]  running
<'rabbit@ip-10-..-..-53'.3.10579.5167> users-realtime  false   false   []                                      0       0       0       1       22336                   [{q1,0}, {q2,0}, {del
ta,{delta,undefined,0,undefined}}, {q3,0}, {q4,0}, {len,0}, {pending_acks,0}, {target_ram_count,0}, {ram_msg_count,0}, {ram_ack_count,0}, {next_seq_id,392646632}, {persistent_count,0}, {avg
_ingress_rate,0.0}, {avg_egress_rate,0.0}, {avg_ack_ingress_rate,0.0}, {avg_ack_egress_rate,0.0}]       running

Exchanges on /:
name    type    durable auto_delete     internal        arguments       policy
        direct  true    false   false   []
amq.direct      direct  true    false   false   []
amq.fanout      fanout  true    false   false   []
amq.headers     headers true    false   false   []
amq.match       headers true    false   false   []
amq.rabbitmq.log        topic   true    false   false   []
amq.rabbitmq.trace      topic   true    false   false   []
amq.topic       topic   true    false   false   []
analytics-bridge-dead-letter    topic   true    false   false   []
entity  topic   true    false   false   []
event   topic   true    false   false   []
event-replay    topic   true    false   false   []
realtime-es     topic   true    false   false   []

Bindings on /:
source_name     source_kind     destination_name        destination_kind        routing_key     arguments
        exchange        dynamo-history  queue   dynamo-history  []
        exchange        dynamo-history-2        queue   dynamo-history-2        []
        exchange        dynamohistory   queue   dynamohistory   []
        exchange        users-realtime  queue   users-realtime  []
event   exchange        dynamo-history  queue   #       []
event   exchange        dynamo-history-2        queue   #       []
event-replay    exchange        dynamo-history  queue   #       []
realtime-es     exchange        users-realtime  queue   #       []

Consumers on /:
queue_name      channel_pid     consumer_tag    ack_required    arguments
dynamo-history  <'rabbit@ip-10-..-..-53'.3.11819.4234> amq.ctag-o8Tl9q3f0zS5k6wH-4Ik6A true    []
dynamo-history  <'rabbit@ip-10-..-..-53'.3.15546.4503> amq.ctag-qIi9XuvX7_tiVIp2Zw3KsA true    []
users-realtime  <'rabbit@ip-10-..-..-53'.3.15341.3614> amq.ctag-M9A-BUTr5Xujsz86lq_J2A true    []

Permissions on /:
user    configure       write   read
rmqadmin        .*      .*      .*
rmqguy  .*      .*      .*

Policies on /:

Parameters on /:

...done.

Michael Klishin

unread,
May 29, 2015, 10:52:53 PM5/29/15
to rabbitm...@googlegroups.com, AMS
On 29 May 2015 at 23:53:18, AMS (dever...@gmail.com) wrote:
> What is the best course of action?

Use a policy to set a short message TTL for that queue.

http://www.rabbitmq.com/ttl.html
https://www.rabbitmq.com/parameters.html 

AMS

unread,
May 30, 2015, 12:23:52 AM5/30/15
to rabbitm...@googlegroups.com, dever...@gmail.com
Thanks!! That is very helpful. That one link says how to apply it to all queue, but I don't yet see a mention of applying it to a specific queue. 

So to apply it to a specific queue, in this case,  "dynamo-history-2" is it this?

rabbitmqctl set_policy TTL ".*" '{"message-ttl":60000}' --apply-to dynamo-history-2

I'll read the links in more detail, but would appreciate your feedback.

AMS

unread,
May 30, 2015, 12:48:20 AM5/30/15
to rabbitm...@googlegroups.com
The command below is wrong given what I read here. 

The "pattern" argument is a regular expression used to match exchange or queue names.
>
> The "apply-to" argument can be "exchanges""queues" or "all"
> The "apply-to" and "priority" settings are optional, in which case the defaults are "all" and "0" respectively.

So the command really needs to be something that sets the pattern to the queue "dynamo-history-2". It seems to avoid setting it to all it needs to be aply-to queue.
I'm going to try to figure out the pattern to specify "dynamo-history-2"

rabbitmqctl set_policy TTL "dynamo-history-2" '{"message-ttl":60000}' --apply-to queues


There only pattern I want to match is "dynamo-history-2".  Does that look right?

AMS

unread,
May 30, 2015, 4:52:19 AM5/30/15
to rabbitm...@googlegroups.com


On Friday, May 29, 2015 at 9:48:20 PM UTC-7, AMS wrote:
The command below is wrong given what I read here. 

The "pattern" argument is a regular expression used to match exchange or queue names.
>
> The "apply-to" argument can be "exchanges""queues" or "all"
> The "apply-to" and "priority" settings are optional, in which case the defaults are "all" and "0" respectively.

So the command really needs to be something that sets the pattern to the queue "dynamo-history-2". It seems to avoid setting it to all it needs to be aply-to queue.
I'm going to try to figure out the pattern to specify "dynamo-history-2"



Tried this:

$ sudo rabbitmqctl set_policy TTL "^dynamo-history-2" '{"message-ttl":3600000}' --apply-to queues
Setting policy "TTL" for pattern "^dynamo-history-2" to "{\"message-ttl\":3600000}" with priority "0" ...


Which did set the policy. 

/       TTL     queues  ^dynamo-history-2       {"message-ttl":3600000} 0


But still that queue is growing.  Any suggestions?

Michael Klishin

unread,
May 30, 2015, 4:55:26 AM5/30/15
to rabbitm...@googlegroups.com, AMS
 On 30 May 2015 at 11:52:22, AMS (dever...@gmail.com) wrote:
> Tried this:
>
> $ sudo rabbitmqctl set_policy TTL "^dynamo-history-2" '{"message-ttl":3600000}'
> --apply-to queues
> Setting policy "TTL" for pattern "^dynamo-history-2" to "{\"message-ttl\":3600000}"
> with priority "0" ...
>
>
>
> Which did set the policy.
>
> / TTL queues ^dynamo-history-2 {"message-ttl":3600000} 0
>
>
> But still that queue is growing. Any suggestions?

Are you sure you want TTL = 3600000?

If your goal is to purge the queue you probably want a much lower value,
e.g 5-15 seconds.

If you want to limit queue length, there's a separate argument for that:
http://www.rabbitmq.com/maxlength.html

AMS

unread,
May 30, 2015, 10:23:53 AM5/30/15
to rabbitm...@googlegroups.com, dever...@gmail.com
Even with a TTL of 360000 of set to an hour I would expect it to stop growing but it isn't.

I've also tried this command:
sudo rabbitmqctl set_policy TTL "^dynamo-history-2$" '{"message-ttl":3600000}' --apply-to queues

creating this policy:
/       TTL     queues  ^dynamo-history-2$      {"message-ttl":3600000} 0


but still the same. Could the priority be too low?

Michael Klishin

unread,
May 30, 2015, 10:51:35 AM5/30/15
to rabbitm...@googlegroups.com, AMS
On 30 May 2015 at 17:23:57, AMS (dever...@gmail.com) wrote:
> Even with a TTL of 360000 of set to an hour I would expect it to stop
> growing but it isn't.

I highly recommend limiting queue length. Message TTL applies to new messages, queue TTL will
delete the entire thing if it is not used (no consumers), which may or may not be expected
by your apps.

Finally, you can purge a queue using rabbitmqctl eval:

./scripts/rabbitmqctl eval '{ok, Q} = rabbit_amqqueue:lookup({resource, <<"/">>, queue, <<"purge-me">>}), rabbit_amqqueue:purge(Q).'

(in the above example queue name is "purge-me" and vhost is "/") 

AMS

unread,
May 30, 2015, 4:54:03 PM5/30/15
to rabbitm...@googlegroups.com, dever...@gmail.com
Again, thanks for your help on this. I put in the message that tried to limit the queue length, but still it is growing. Text below is from console. (with IPs obscured). Could it be something about this being version 3.2.1?

I've not tried the script yet.

--

ubuntu@ip-10-..-..-53:~$ sudo rabbitmqctl set_policy Ten "dynamo-history-2" '{"max-length-bytes":10000000}' --apply-to queues
Setting policy "Ten" for pattern "dynamo-history-2" to "{\"max-length-bytes\":10000000}" with priority "0" ...
Error: Validation failed

[{<<"max-length-bytes">>,10000000}] are not recognised policy settings

ubuntu@ip-10-..-..-53:~$ sudo rabbitmqctl set_policy Ten "dynamo-history-2" '{"max-length":10000}' --apply-to queues
Setting policy "Ten" for pattern "dynamo-history-2" to "{\"max-length\":10000}" with priority "0" ...
...done.
ubuntu@ip-10-..-..-53:~$ sudo rabbitmqctl list_queues
Listing queues ...
dynamo-history  7
dynamo-history-2        33390407
dynamohistory   0
users-realtime  0
...done.
ubuntu@ip-10-..-..-53:~$ sudo rabbitmqctl list_queues
Listing queues ...
dynamo-history  15
dynamo-history-2        33391213
dynamohistory   0
users-realtime  0
...done.
ubuntu@ip-10-..-..-53:~$ sudo rabbitmqctl list_queues
Listing queues ...
dynamo-history  31
dynamo-history-2        33395545
dynamohistory   0
users-realtime  0
...done.
ubuntu@ip-10-..-..-53:~$ sudo rabbitmqctl list_queues
Listing queues ...
dynamo-history  13
dynamo-history-2        33398948
dynamohistory   0
users-realtime  0
...done.

AMS

unread,
May 30, 2015, 5:46:14 PM5/30/15
to rabbitm...@googlegroups.com, dever...@gmail.com
This worked well. It purged the queue back down to zero. After running is starts to grow again, so the policies commands I tried earlier didn't take hold but this worked. 

Thanks.

Michael Klishin

unread,
May 31, 2015, 12:10:12 AM5/31/15
to AMS, rabbitm...@googlegroups.com
Did you delete the earlier created policy?
What are your expectations? With both queue limit and TTL you will see some queue growth if messages are routed there. But it will be bounded, that's the difference.

MK
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

AMS

unread,
May 31, 2015, 11:01:52 AM5/31/15
to rabbitm...@googlegroups.com, dever...@gmail.com
No I didn't. I'll make that change soon.
Reply all
Reply to author
Forward
0 new messages