rabbitmqadmin命令行管理工具-4
rabbitmqadmin命令行管理工具原文地址:
https://www.cnblogs.com/wuzhiyuan/p/6856985.html
https://www.cnblogs.com/mrxiaohe/p/6604436.html
https://blog.csdn.net/zhengzizhi/article/details/77032148
rabbitmqadmin安装
rabbitmqadmin 帮助页面 http://www.rabbitmq.com/management-cli.html wget http://xxx:15672/cli/rabbitmqadmin 可下载rabbtimqadmin脚本
rabbitmqadmin查看
rabbitmqadmin list users #查看用户列表 rabbitmqadmin list vhosts #查看vhosts rabbitmqadmin list connections ###查看 connections rabbitmqadmin list exchanges ##查看 exchanges rabbitmqadmin list bindings ##查看 bindings rabbitmqadmin list permissions ##查看 permissions rabbitmqadmin list channels ##查看 channels rabbitmqadmin list parameters ##查看 parameters rabbitmqadmin list consumers ##查看consumers rabbitmqadmin list queues ##查看queues rabbitmqadmin list policies ##查看policies rabbitmqadmin list nodes ##查看nodes rabbitmqadmin show overview ##查看overview 使用 -f 可以指定格式 有如下几种格式 raw_json, long, pretty_json, kvp, tsv, table, bash 默认为 table [root@rabbitmq1 sbin]# rabbitmqadmin -f long list users -------------------------------------------------------------------------------- name: admin hashing_algorithm: rabbit_password_hashing_sha256 password_hash: p+DWMXK6kA1K5o/gstcinGIKzhq/4tcoCME5G/J1xGOHDUDy tags: administrator -------------------------------------------------------------------------------- name: guest hashing_algorithm: rabbit_password_hashing_sha256 password_hash: 2MmYKK/XqZXFjgnOxAHgOZ4M5LT3CFOI2KeR0BH9XFzHF/qr tags: administrator --------------------------------------------------------------------------------
queue操作
添加queue rabbitmqadmin declare queue name=test durable=true ## durable=true 代表持久化打开 declare是宣布的意思 rabbitmqadmin --vhost=test --username=admin --password=admin declare queue name=test durable=true #指定vhost添加队列 查看queues [root@rabbitmq1 sbin]# rabbitmqadmin list queues +------+----------+ | name | messages | +------+----------+ | test | 0 | +------+----------+ #查看bindings [root@rabbitmq1 sbin]# rabbitmqadmin list bindings +--------+-------------+-------------+ | source | destination | routing_key | +--------+-------------+-------------+ | | test | test | +--------+-------------+-------------+ #添加消息到test queue rabbitmqadmin publish routing_key=test payload="this is a testing" ##未指定exchange默认 exchange name为空 再次查看对列发现test有一条消息 [root@rabbitmq1 sbin]# rabbitmqadmin list queues +------+----------+ | name | messages | +------+----------+ | test | 1 | +------+----------+ #从test queue消费一条信息 rabbitmqadmin get queue=test requeue=true #requeue=true 这条消息消费后还在,反之如果为false消费后消息就不在了。 #删除队列 rabbitmqadmin delete queue name=test #清除队列消息内容 rabbitmqadmin purge queue name=队列名