RabbitMQ是一款开源的消息队列代理工具,负责消息队列的存储和使用,主要为消息的各种使用方式提供了更多的拓展,比如订阅模式,工作队列模式等。为开发者提供了便利。
通过yum在线安装,简单、快捷、自动安装相关依赖包。(需要你的服务器处于联网状态)
1.安装Erlang环境(RabbitMQ由Erlang语言开发)
1.1)下载Erlang的rpm安装包
wget -O erlang-20.3.4-1.el7.CentOS.x86_64.rpm https://bintray.com/rabbitmq/rpm/download_file?file_path=erlang%2F20%2Fel%2F7%2Fx86_64%2Ferlang-20.3.4-1.el7.centos.x86_64.rpm
1.2)安装Erlang
yum install -y erlang-20.3.4-1.el7.centos.x86_64.rpm
1.3)检查Erlang是否安装成功
[root@localhost ~]# erl -version
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 9.3
[root@localhost ~]#
2.安装RabbitMQ
2.1)下载rpm安装包
wget https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.4/rabbitmq-server-3.7.4-1.el7.noarch.rpm
2.2)安装RabbitMQ
yum install -y rabbitmq-server-3.7.4-1.el7.noarch.rpm
2.3)检查RabbitMQ是否安装成功
[root@localhost ~]# rabbitmqctl status
Status of node rabbit@localhost ...
[{pid,14618},
{running_applications,
[{rabbitmq_management,"RabbitMQ Management Console","3.7.4"},
{rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.4"},
{amqp_client,"RabbitMQ AMQP Client","3.7.4"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.4"},
{cowboy,"Small, fast, modern HTTP server.","2.2.2"},
{cowlib,"Support library for manipulating Web protocols.","2.1.0"},
{rabbit,"RabbitMQ","3.7.4"},
{rabbit_common,
"Modules shared by rabbitmq-server and rabbitmq-erlang-client",
"3.7.4"},
...
3.启动RabbitMQ
3.1 ) 设置开机启动(即设置为守护线程)
chkconfig rabbitmq-server on
3.2 ) 启动mq服务
service rabbitmq-server start ----启动mq
systemctl status rabbitmq-server.service ----查看rabbitmq状态
rabbitmqctl stop ----停止mq服务
4.安装web管理界面插件
1.安装 :
rabbitmq-plugins enable rabbitmq_management
2.成功后会有如下内容 :
The following plugins hava been enabled:
mochiweb
webmachine
rabbitmq_web_dispatch
amqp_client.....
Plugin configuration has changed .Restart RabbitMQ for changes to take effect.
5.新增个人账号,用于远程登录
1.创建账号
rabbitmqctl add_user agan 123456
2.设置用户角色
rabbitmqctl set_user_tags heming administrator
3.设置用户权限
rabbitmqctl set_permissions -p "/" agan ".*" ".*" ".*"
4.设置完成后可以查看当前用户和角色(需要开启服务)
rabbitmqctl list_users
5.完成后在自己的浏览器输入 serverip:15672 其中serverip 是rabbitmq-server所在主机的ip
更多RabbitMQ相关教程见以下内容:
CentOS 7.2 下 RabbitMQ 集群搭建 https://www.linuxidc.com/Linux/2016-12/137812.htm
CentOS7环境安装使用专业的消息队列产品RabbitMQ https://www.linuxidc.com/Linux/2016-11/13673.htm
RabbitMQ入门教程 https://www.linuxidc.com/Linux/2015-02/113983.htm
在CentOS7上安装RabbitMQ 详解 https://www.linuxidc.com/Linux/2017-05/143765.htm
NServiceBus 结合 RabbitMQ 使用教程 https://www.linuxidc.com/Linux/2017-05/143787.htm
CentOS 7下RabbitMQ集群安装配置 https://www.linuxidc.com/Linux/2017-10/147707.htm
RabbitMQ实战:高效部署分布式消息队列 中文PDF扫描版 https://www.linuxidc.com/Linux/2017-10/147592.htm
CentOS7上RabbitMQ安装详述 https://www.linuxidc.com/Linux/2017-12/149202.htm
RabbitMQ分布式集群架构和高可用性(HA) https://www.linuxidc.com/Linux/2017-12/149466.htm
CentOS 7下安装配置RabbitMQ详细教程 https://www.linuxidc.com/Linux/2018-01/150600.htm
RabbitMQ在CentOS 7中安装配置教程 https://www.linuxidc.com/Linux/2018-04/151796.htm