Skip to content

Instantly share code, notes, and snippets.

@jemc
Created July 16, 2016 13:38
Show Gist options
  • Save jemc/330fba213ff187f2b25834f5683cea0b to your computer and use it in GitHub Desktop.
Save jemc/330fba213ff187f2b25834f5683cea0b to your computer and use it in GitHub Desktop.
# List all mnesia tables used in the server.
rabbitmqctl eval 'mnesia:system_info(tables).'
# => [rabbit_exchange_type_consistent_hash,mirrored_sup_childspec,gm_group,
# rabbit_queue,rabbit_durable_queue,rabbit_runtime_parameters,
# rabbit_exchange_serial,rabbit_exchange,rabbit_durable_exchange,
# rabbit_topic_trie_binding,rabbit_topic_trie_edge,rabbit_topic_trie_node,
# rabbit_reverse_route,rabbit_route,rabbit_semi_durable_route,
# rabbit_durable_route,rabbit_listener,rabbit_vhost,rabbit_user_permission,
# rabbit_user,schema]
# List all queues on all vhosts.
rabbitmqctl eval 'mnesia:dirty_all_keys(rabbit_queue).'
# Get the Pid of the given queue.
rabbitmqctl eval '
[Q] = mnesia:dirty_read({rabbit_queue, {resource,<<"my-vhost">>,queue,<<"my.queue.name">>}}),
{_, _, _, _, _, _, Pid, _, _, _, _, _, _, _} = Q,
Pid.
'
# List consumers the given queue, by calling its pid
rabbitmqctl eval '
[Q] = mnesia:dirty_read({rabbit_queue, {resource,<<"my-vhost">>,queue,<<"my.queue.name">>}}),
{_, _, _, _, _, _, Pid, _, _, _, _, _, _, _} = Q,
gen_server2:call(Pid, consumers).
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment