欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

消息队列rabbitmq命令集合

程序员文章站 2022-07-13 15:43:55
...

1. 启动

rabbitmq-server &

2. 队列重置(清空队列、用户等)

rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl stop

3. 关闭

rabbitmqctl stop

4. 列举所有用户

rabbitmqctl list_users

5. 列举所有队列

rabbitmqctl list_queues

6. 添加用户

rabbitmqctl add_user user_name user_passwd

7. 设置用户角色为管理员

rabbitmqctl set_user_tags user_name administrator

8. 权限设置

rabbitmqctl set_permissions -p / user_name ".*" ".*" ".*"
6,7,8三步操作举例(添加用户admin)
sudo rabbitmqctl add_user admin admin
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"

9. 查看状态

rabbitmqctl status

10.安装 RabbitMQWeb管理插件

rabbitmq-plugins enable rabbitmq_management  
可以利用http://ip:15672查看界面状态
消息队列rabbitmq命令集合
            
    
    博客分类: rabbitmq消息中间件 rabbitmq消息中间件 

11.疑难杂症

11.1 症状:启动后出现
1
2
3
4
5
6
7
8
Error: unable to connect to node 'rabbit@idcp-mq010177080030': nodedown
Error in log handler
====================
Event: {error,<0.9.0>,
              {<0.451.0>,
               "** Connection attempt from disallowed node ~w ** ~n",
               ['rabbitmq-cli-3355@idcp-mq010177080030']}}
Error: function_clause

破解

重启服务

sudo rabbitmq-server restart

 

11.2 无法正常启动rabbitmq-server

Error: unable to connect to node rabbit@nu5i12294: nodedown
ERROR: epmd error for host nu5i12294: address (cannot connect to host/port

解决:

http://yodi.polatic.me/solve-rabbitmq-error-epmd-error-for-host-ubuntu-address-cannot-connect-to-hostport/

判断hostname 与/host/hosts里面的ip和主机名一致

例如,ip为10.10.10.10

检查hostname:

$hostname
host_jihite

检查  /etc/hosts

10.10.10.10  host_jihite

12. RabbitMQ 集群与高可用配置

http://88250.b3log.org/rabbitmq-clustering-ha