1、常用命令如下:
查看RabbitMQ服务状态:rabbitmqctl status
启用web插件:rabbitmq-plugins enable rabbitmq_management
添加页面用户及密码:rabbitmqctl add_user admin 123456
赋予其administrator角色:rabbitmqctl set_user_tags admin administrator
设置权限:rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
查看所有用户:rabbitmqctl list_users
查看用户权限:rabbitmqctl list_user_permissions admin
删除用户:rabbitmqctl delete_user guest
修改用户密码:rabbitmqctl change_password admin admin
清除用户密码:rabbitmqctl clear_password admin
验证密码:rabbitmqctl authenticate_user admin admin@2022
清除用户权限: rabbitmqctl clear_permissions -p / admin
查看策略: rabbitmqctl list_policies
清除策略: rabbitmqctl clear_policy name #name 策略名称
创建一个队列,打开持久化 rabbitmqadmin declare queue name=myj-mq durable=true
查看队列: rabbitmqctl list_queues
删除队列: rabbitmqadmin delete queue name=myj-mq
创建一个交换器:rabbitmqadmin declare exchange name=my.topic durable=true type=topic
列出交换器: rabbitmqadmin list exchanges
删除交换器: rabbitmqadmin delete exchange name=my.topic
创建binding: rabbitmqadmin declare binding source=my.topic destination=myj-mq routing_key=myj-mq
#source: 交换器
#destination:队列
#routing_key:路由key
列出binding: rabbitmqadmin list bindings
发布一条消:rabbitmqadmin publish exchange=my.topic routing_key=myj-mq payload="just for test"
删除路由和队列的绑定关系:rabbitmqadmin delete binding source='my.topic' destination_type=queue destination=myj-mq properties_key=myj-mq
查看消息: rabbitmqadmin get queue=myj-mq
查看集群状态:rabbitmqctl cluster_status
查看所有链接:rabbitmqadmin list connections
清空队列消息:rabbitmqadmin purge queue name=myj-mq
配置账号密码:
rabbitmqctl add_user myj myj123.com
rabbitmqctl set_permissions -p / myj".*" ".*" ".*"
rabbitmqctl set_user_tags myj administrator
2、rabbitmqadmin 安装步骤
2.1 wget http://192.168.6.11:15672/cli/rabbitmqadmin
2.2 mv rabbitmqadmin /usr/local/bin/
2.3 chmod 777 /usr/local/bin/rabbitmqadmin
2.4 yum install python3 -y
2.5 rabbitmqadmin --help # 查看
标签:name,admin,Rabbitmq,rabbitmqctl,myj,集群,rabbitmqadmin,常用命令,mq From: https://www.cnblogs.com/zbhlinux/p/17272998.html