1. 启动
rabbitmq-server &
2. 队列重置(清空队列、用户等)
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl stop
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查看界面状态
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
13. Rabbitmq的mnesia数据地址
1. 停止消息队列
sudo rabbitmqctl stop
2. 创建mnesia目录,修改用户属性
mkdir mnesia
sudo chown rabbitmq:rabbitmq /home/test/mnesia
3. 修改默认MNESIA_BASE地址
vim /usr/lib/rabbitmq/bin/rabbitmq-defaults
MNESIA_BASE=${SYS_PREFIX}/var/lib/rabbitmq/mnesia
改为 MNESIA_BASE=${SYS_PREFIX}/home/test/mnesia
4. 启动消息队列
sudo rabbitmq-server &
5. 建立admin用户
sudo rabbitmqctl add_user admin admin sudo rabbitmqctl set_user_tags admin administrator sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
本文转自jihite博客园博客,原文链接:http://www.cnblogs.com/kaituorensheng/p/4985767.html,如需转载请自行联系