前言:
对于消息队列中间件:
#redis: 功能比较全,但是如果突然停止运行或断电会造成数据丢失
#RabbitMQ:功能比较齐全、稳定、便于安装,在生产环境来说是首选的
1.安装erlang:
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm 安装erlang的yum源
yum install erlang
验证:
2.安装:rabbitmq
rabbitmq github地址:https://github.com/rabbitmq/rabbitmq-server/releases
注意centos 7.x 下,对应el7
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.5/rabbitmq-server-3.8.5-1.el7.noarch.rpm #注意:国内下载较慢,最好用海外服务器下载
rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
yum install rabbitmq-server-3.8.5-1.el7.noarch.rpm
3.启动web管理插件:rabbitmq-plugins enable rabbitmq_management
4.启动rabbitmq服务:systemctl restart rabbitmq-server.service
5.添加远端登录账户
#添加用户 admin 密码为 123456
rabbitmqctl add_user admin 123456
#将admin 设置为管理员权限
rabbitmqctl set_user_tags admin administrator
#将admin 设置为远端登录
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
删除guest
rabbitmqctl delete_user guest
6.登录rabbitmq
访问地址: http://localhost:15672
使用 admin 密码 123456 进行登录