5

我已按照RabbitMQ 管理命令行工具的说明进行操作,但在使用

python.exe rabbitmqadmin.exe 

给我一个错误:

ERROR: Action not specified

和:

rabbitmqadmin --help 

显示:

在此处输入图像描述

真的是这样还​​是我做错了什么?

4

2 回答 2

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
于 2012-11-14T14:51:03.300 回答
7

该错误的意思正是它所说的,您没有通过指定命令正确调用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 |
+-------+--------------------------------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+
于 2014-09-08T17:51:07.510 回答