RabbitMQ
RabbitMQ是一个出色的消息代理中间件(Message Broker):接受和转发消息。你可以将它看作是一个邮局,
你把自己的信件写上收件人地址,然后放到邮筒里面就不用管了,由邮局负责将这个信件送到目的地。来自
一、安装
我这里使用的是 ArchLInux
1 2
| sudo pacman -S rabbitmq
|
RPM 安装
1 2 3 4 5 6 7 8 9 10 11 12 13
| rpm -Uvh https://mirrors.ustc.edu.cn/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
yum install epel-release yum install erlang
rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.15/rabbitmq-server-3.6.15-1.el7.noarch.rpm ll yum install rabbitmq-server-3.6.15-1.el7.noarch.rpm
|
安装web管理界面
1 2 3
| sudo rabbitmq-plugins enable rabbitmq_management
sudo rabbitmq-plugins list
|
启动
1 2 3 4 5 6
| systemctl enable rabbitmq-server
systemctl start rabbitmq-server
systemctl restart rabbitmq-server
|
配置
1
| vim /etc/rabbitmq/rabbitmq.config
|
安装好之后在/usr/share/doc/rabbitmq-server-3.6.15/
有参考模板rabbitmq.config.example
配置端口,备注:消息端口5672
,则web访问端口为 15672
1 2 3 4 5 6 7 8
| [ {rabbit, [ {loopback_users, []}, {tcp_listeners, [5672]} ] } ]
|
参考模板
用户管理
1 2 3 4 5 6 7 8 9 10 11 12
| sudo rabbitmqctl list_users sudo rabbitmqctl change_password guest guest
sudo rabbitmqctl add_user maxzhao maxzhao
sudo rabbitmqctl set_user_tags maxzhao administrator
sudo rabbitmqctl set_permissions -p / maxzhao ".*" ".*" ".*"
|
添加vhost
1 2 3 4 5 6 7 8 9 10 11
| sudo rabbitmqctl --help
sudo rabbitmqctl add_vhost --help
sudo rabbitmqctl add_vhost maxzhao_vhost
sudo rabbitmqctl list_vhosts
sudo rabbitmqctl set_permissions -p /maxzhao_vhost maxzhao ".*" ".*" ".*"
|
删除 vhost
1 2
| sudo rabbitmqctl add_vhost maxzhaoTest sudo rabbitmqctl delete_vhost maxzhaoTest
|
本文地址: https://github.com/maxzhao-it/blog/post/14489/