(1)安装rabbitMQ
echo 'deb http://www.rabbitmq.com/debian/ testing main' |
sudo tee /etc/apt/sources.list.d/rabbitmq.list
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc |
sudo apt-key add -
wget -O- https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc |
sudo apt-key add -
sudo apt-get update
sudo apt-get install rabbitmq-server
(2)启动rabbitMQ
sudo service rabbitmq-server start
(3)添加用户
sudo rabbitmqctl add_user Username Password
(4)设置用户角色
sudo rabbitmqctl set_user_tags Username administrator
(5)设置用户权限
sudo rabbitmqctl set_permissions -p / Username '.*' '.*' '.*'
(6)常用命令
Ø 启动服务
rabbitmq-server start
Ø 停止服务
rabbitmq-server stop
Ø 查看队列中的数据
rabbitmqctl list_queues
Ø 查看节点状态
rabbitmqctl status
Ø 查看分布式节点状态
rabbitmqctl cluster_status
Ø 停止应用
rabbitmqctl stop_app
Ø 启动应用
rabbitmqctl start_app
Ø 重设应用
rabbitmqctl reset
Ø 加入分布式节点
rabbitmqctl cluster 节点标识
Ø 具体参考:
rabbitmqctl –help
Ø 查看未确认消息:
rabbitmqctl list_queues -p / name