格式化输出
使用 -f
可以指定格式
有如下几种格式 raw_json, long, pretty_json, kvp, tsv, table, bash
默认为 table
代码语言:javascript复制[root@h102 rabbitmq]# rabbitmqadmin list users
------- ----------------------------- ------------------------------ ---------------
| name | hashing_algorithm | password_hash | tags |
------- ----------------------------- ------------------------------ ---------------
| guest | rabbit_password_hashing_md5 | 7jG486YR6/F0hVLWYfCnqRyxKe4= | administrator |
------- ----------------------------- ------------------------------ ---------------
[root@h102 rabbitmq]# rabbitmqadmin -f raw_json list users
[{"name":"guest","password_hash":"7jG486YR6/F0hVLWYfCnqRyxKe4=","hashing_algorithm":"rabbit_password_hashing_md5","tags":"administrator"}]
[root@h102 rabbitmq]# rabbitmqadmin -f long list users
--------------------------------------------------------------------------------
name: guest
hashing_algorithm: rabbit_password_hashing_md5
password_hash: 7jG486YR6/F0hVLWYfCnqRyxKe4=
tags: administrator
--------------------------------------------------------------------------------
[root@h102 rabbitmq]# rabbitmqadmin -f pretty_json list users
[
{
"hashing_algorithm": "rabbit_password_hashing_md5",
"name": "guest",
"password_hash": "7jG486YR6/F0hVLWYfCnqRyxKe4=",
"tags": "administrator"
}
]
[root@h102 rabbitmq]# rabbitmqadmin -f kvp list users
name="guest" hashing_algorithm="rabbit_password_hashing_md5" password_hash="7jG486YR6/F0hVLWYfCnqRyxKe4=" tags="administrator"
[root@h102 rabbitmq]# rabbitmqadmin -f tsv list users
name hashing_algorithm password_hash tags
guest rabbit_password_hashing_md5 7jG486YR6/F0hVLWYfCnqRyxKe4= administrator
[root@h102 rabbitmq]# rabbitmqadmin -f table list users
------- ----------------------------- ------------------------------ ---------------
| name | hashing_algorithm | password_hash | tags |
------- ----------------------------- ------------------------------ ---------------
| guest | rabbit_password_hashing_md5 | 7jG486YR6/F0hVLWYfCnqRyxKe4= | administrator |
------- ----------------------------- ------------------------------ ---------------
[root@h102 rabbitmq]# rabbitmqadmin -f bash list users
guest
[root@h102 rabbitmq]#
定义一个 queue
代码语言:javascript复制[root@h102 rabbitmq]# rabbitmqadmin list bindings
No items
[root@h102 rabbitmq]# rabbitmqadmin list queues
No items
[root@h102 rabbitmq]# rabbitmqadmin declare queue name=test durable=true
queue declared
[root@h102 rabbitmq]# rabbitmqadmin list queues
------ ----------
| name | messages |
------ ----------
| test | 0 |
------ ----------
[root@h102 rabbitmq]# rabbitmqadmin list bindings
-------- ------------- -------------
| source | destination | routing_key |
-------- ------------- -------------
| | test | test |
-------- ------------- -------------
[root@h102 rabbitmq]#
durable=true 代表持久化打开
发现定义一个新的queue后,RabbitMQ会自动为之创建一个 binding