如何让RabbitMQ管理命令行工具在Windows上运行

时间:2012-11-14 13:01:32

标签: windows-8 rabbitmq

我已按照说明RabbitMQ management command line tool进行操作,但在使用

运行时
python.exe rabbitmqadmin.exe 

给我一​​个错误:

ERROR: Action not specified

rabbitmqadmin --help 

显示:

enter image description here

这是真的如此,还是我做错了什么?

2 个答案:

答案 0 :(得分:9)

不要将rabbitmqadmin重命名为rabbitmqadmin.exe - 它实际上不是可执行文件。这就是你所看到的(非常误导)“由于不兼容而无法启动”的原因。

ERROR: Action not specified

是由于......未指定动作。

但是你可能会遗漏的一点是,在Windows上你总是需要使用python.exe为调用添加前缀,例如:

python.exe rabbitmqadmin --help
python.exe rabbitmqadmin declare exchange name=my-exchange type=topic

答案 1 :(得分:6)

错误意味着它所说的内容,你没有通过指定命令正确调用rabbitmqadmin。

继续讨论如何使用rabbitmqadmin:

对我来说,可执行文件被称为:rabbitmqadmin从这里下载: https://www.rabbitmq.com/management-cli.html

在没有任何选项的情况下从命令行执行它,并且您收到错误:

eric@dev ~$ python rabbitmqadmin
ERROR: Action not specified
rabbitmqadmin --help for help

获取有关通用选项的帮助:

eric@dev ~$ python rabbitmqadmin --help
<prints a mountain of help>

获取可以运行的子命令列表:

python rabbitmqadmin help subcommands

获取用户列表:

eric@dev ~$ python rabbitmqadmin list users
+-------+------------------------------+---------------+
| name  |        password_hash         |     tags      |
+-------+------------------------------+---------------+
| guest | oiz5zGozWya1qBblv6gbFrGYCnA= | administrator |
+-------+------------------------------+---------------+

列出虚拟广告:

eric@dev ~$ python rabbitmqadmin list vhosts
+------+----------+----------------+-------------------------+----------+----------+---------+
| name | messages | messages_ready | messages_unacknowledged | recv_oct | send_oct | tracing |
+------+----------+----------------+-------------------------+----------+----------+---------+
| /    | 0        | 0              | 0                       | 1218     | 1028     | False   |
| foo  |          |                |                         |          |          | False   |
+------+----------+----------------+-------------------------+----------+----------+---------+

列出交换:

eric@dev ~$ python rabbitmqadmin list exchanges
+-------+--------------------+---------+-------------+---------+----------+
| vhost |        name        |  type   | auto_delete | durable | internal |
+-------+--------------------+---------+-------------+---------+----------+
| /     |                    | direct  | False       | True    | False    |
| /     | amq.direct         | direct  | False       | True    | False    |
| /     | amq.fanout         | fanout  | False       | True    | False    |
| /     | amq.headers        | headers | False       | True    | False    |
| /     | amq.match          | headers | False       | True    | False    |
| /     | amq.rabbitmq.log   | topic   | False       | True    | False    |
| /     | amq.rabbitmq.trace | topic   | False       | True    | False    |
| /     | amq.topic          | topic   | False       | True    | False    |
| /     | logs               | fanout  | False       | False   | False    |
| /     | my-exchange        | topic   | False       | True    | False    |
+-------+--------------------+---------+-------------+---------+----------+

以默认用户身份登录并获取节点:

python rabbitmqadmin --username=guest --password=guest list nodes

<prints mountain of information about nodes>

以访客身份登录和列出队列:

eric@dev ~$ python rabbitmqadmin --username=guest --password=guest list queues
+-------+--------------------------------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+
| vhost |              name              | auto_delete | consumers | durable | exclusive_consumer_tag |     idle_since      | memory | messages | messages_ready | messages_unacknowledged |        node         | policy | status  |
+-------+--------------------------------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+
| /     | amq.gen-hWC6xdjX3g5GABc2nED-YQ | True        | 1         | False   |                        | 2014-09-08 13:24:34 | 14048  | 0        | 0              | 0                       | rabbit@ip-15-1-5-54 |        | running |
+-------+--------------------------------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+