参考:
http://www.rabbitmq.com/management-cli.html
拥有跟Web UI同样的功能,可能还更便于脚本使用。rabbitmqadmin仅仅是一个定制的HTTP客户端,如果想在自己的程序中引入 rabbitmqadmin的话,可以直接使用HTTP API。rabbitmqadmin可以在http://server-name:15672/cli页面下载
访问页面:wget http://server-name:15672/cli ,获取index.html
访问页面:wget http://223.202.46.152:15672/cli/rabbitmqadmin , 获取rabbitmqadmin
Unix users will probably want to copy rabbitmqadmin to /usr/local/bin.
Windows users will need to ensure Python is on their path, and invoke rabbitmqadmin as python.exe rabbitmqadmin.
Invoke rabbitmqadmin --help for usage instructions. You can:
list exchanges, queues, bindings, vhosts, users, permissions, connections and channels.
show overview information.
declare and delete exchanges, queues, bindings, vhosts, users and permissions.
publish and get messages.
close connections and purge queues.
import and export configuration.
/root/rabbitmqadmin --help
Usage
=====
rabbitmqadmin [options] subcommand
Options
=======
--help, -h show this help message and exit
--config=CONFIG, -c CONFIG
configuration file [default: ~/.rabbitmqadmin.conf]
--node=NODE, -N NODE node described in the configuration file [default:
'default' only if configuration file is specified]
--host=HOST, -H HOST connect to host HOST [default: localhost]
--port=PORT, -P PORT connect to port PORT [default: 15672]
--vhost=VHOST, -V VHOST
connect to vhost VHOST [default: all vhosts for list,
'/' for declare]
--username=USERNAME, -u USERNAME
connect using username USERNAME [default: guest]
--password=PASSWORD, -p PASSWORD
connect using password PASSWORD [default: guest]
--quiet, -q suppress status messages [default: True]
--ssl, -s connect with ssl [default: False]
--ssl-key-file=SSL_KEY_FILE
PEM format key file for SSL
--ssl-cert-file=SSL_CERT_FILE
PEM format certificate file for SSL
--format=FORMAT, -f FORMAT
format for listing commands - one of [raw_json, long,
pretty_json, kvp, tsv, table, bash] [default: table]
--sort=SORT, -S SORT sort key for listing queries
--sort-reverse, -R reverse the sort order
--depth=DEPTH, -d DEPTH
maximum depth to recurse for listing tables [default:
1]
--bash-completion Print bash completion script [default: False]
--version Display version and exit
More Help
=========
For more help use the help subcommand:
rabbitmqadmin help subcommands # For a list of available subcommands
rabbitmqadmin help config # For help with the configuration fil
/root/rabbitmqadmin help subcommands
Usage
=====
rabbitmqadmin [options] subcommand
where subcommand is one of:
Display
=======
list users [<column>...]
list vhosts [<column>...]
list connections [<column>...]
list exchanges [<column>...]
list bindings [<column>...]
list permissions [<column>...]
list channels [<column>...]
list parameters [<column>...]
list consumers [<column>...]
list queues [<column>...]
list policies [<column>...]
list nodes [<column>...]
show overview [<column>...]
Object Manipulation
===================
declare queue name=... [node=... auto_delete=... durable=... arguments=...]
declare vhost name=... [tracing=...]
declare user name=... password=... tags=...
declare exchange name=... type=... [auto_delete=... internal=... durable=... arguments=...]
declare policy name=... pattern=... definition=... [priority=... apply-to=...]
declare parameter component=... name=... value=...
declare permission vhost=... user=... configure=... write=... read=...
declare binding source=... destination=... [arguments=... routing_key=... destination_type=...]
delete queue name=...
delete vhost name=...
delete user name=...
delete exchange name=...
delete policy name=...
delete parameter component=... name=...
delete permission vhost=... user=...
delete binding source=... destination_type=... destination=... properties_key=...
close connection name=...
purge queue name=...
Broker Definitions
==================
export <file>
import <file>
Publishing and Consuming
========================
publish routing_key=... [exchange=... payload=... payload_encoding=... properties=...]
get queue=... [count=... requeue=... payload_file=... encoding=...]
* If payload is not specified on publish, standard input is used
* If payload_file is not specified on get, the payload will be shown on
standard output along with the message metadata
* If payload_file is specified on get, count must not be set
/root/rabbitmqadmin help config
Usage
=====
rabbitmqadmin [options] subcommand
Configuration File
==================
It is possible to specify a configuration file from the command line.
Hosts can be configured easily in a configuration file and called
from the command line.
Example
=======
# rabbitmqadmin.conf.example START
[host_normal]
hostname = localhost
port = 15672
username = guest
password = guest
declare_vhost = / # Used as default for declare / delete only
vhost = / # Used as default for declare / delete / list
[host_ssl]
hostname = otherhost
port = 15672
username = guest
password = guest
ssl = True
ssl_key_file = /path/to/key.pem
ssl_cert_file = /path/to/cert.pem
# rabbitmqadmin.conf.example END
Use
===
rabbitmqadmin -c rabbitmqadmin.conf.example -N host_normal ..