RabbitMQ安装

如果觉得我写的还行,请关注我的博客并且点个赞哟
该篇文章内容主要介绍在linux系统上安装RabbitMq的教程



前言

在做项目时用到消息队列,于是深入了解了消息队列知识,并在linux上安装了Rabbitmq,本博客介绍Rabbitmq的安装教程。


以下是本篇文章正文内容,下面案例可供参考

一、RabbitMQ是什么?

RabbitMQ是流行的开源消息队列系统,是AMQP(Advanced Message Queuing Protocol高级消息队列协议)的标准实现,用erlang语言开发。RabbitMQ据说具有良好的性能和时效性,同时还能够非常好的支持集群和负载部署,非常适合在较大规模的分布式系统中使用。

二、RabbitMQ安装步骤

1.安装Erlang

由于RabbitMQ是基于Erlang(面向高并发的语言)语言开发,所以在安装RabbitMQ之前,需要先安装Erlang。在本教程中我们将安装最新版本的Erlang到服务器中。 Erlang在默认的YUM存储库中不可用,因此您将需要安装EPEL存储库。 运行以下命令相同。
#执行命令1
yum -y install epel-release
#命令1执行完毕后执行命令2
yum -y install erlang socat

执行查看Erlang版本

[root@localhost alidata]# erl -version
#版本查看结果
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.10.4

2.安装RabbitMQ

2.1下载RabbitMQ

使用wget直接在服务器上下载
#wget 命令下载文件
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.9/rabbitmq-server-3.8.9-1.el7.noarch.rpm
#上传文件后查看文件
[root@localhost rabbitmq]# ll
total 15168
-rw-r--r--. 1 root root 15525852 Oct 28 01:45 rabbitmq-server-3.8.9-1.el7.noarch.rpm
[root@localhost rabbitmq]# 

2.2安装RabbitMQ

#执行安装命令
 yum install rabbitmq-server-3.6.6-1.el7.noarch.rpm
[root@localhost rabbitmq]# yum install rabbitmq-server-3.6.6-1.el7.noarch.rpm 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * centos-sclo-rh: mirrors.cqu.edu.cn
 * centos-sclo-sclo: mirrors.huaweicloud.com
 * epel: fedora.cs.nctu.edu.tw
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
No package rabbitmq-server-3.6.6-1.el7.noarch.rpm available.
Error: Nothing to do
[root@localhost rabbitmq]# ll
total 15168
-rw-r--r--. 1 root root 15525852 Oct 28 01:45 rabbitmq-server-3.8.9-1.el7.noarch.rpm
-rw-r--r--. 1 root root      833 Oct 28 01:45 rabbitmq-server-3.8.9-1.el7.noarch.rpm.asc
[root@localhost rabbitmq]# yum install rabbitmq-server-3.8.9-1.el7.noarch.rpm
Loaded plugins: fastestmirror, langpacks
Examining rabbitmq-server-3.8.9-1.el7.noarch.rpm: rabbitmq-server-3.8.9-1.el7.noarch
Marking rabbitmq-server-3.8.9-1.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package rabbitmq-server.noarch 0:3.8.9-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                     Arch                               Version                                  Repository                                                       Size
===============================================================================================================================================================================================
Installing:
 rabbitmq-server                             noarch                             3.8.9-1.el7                              /rabbitmq-server-3.8.9-1.el7.noarch                              15 M

Transaction Summary
===============================================================================================================================================================================================
Install  1 Package

Total size: 15 M
Installed size: 15 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : rabbitmq-server-3.8.9-1.el7.noarch                                                                                                                                          1/1 
  Verifying  : rabbitmq-server-3.8.9-1.el7.noarch                                                                                                                                          1/1 

Installed:
  rabbitmq-server.noarch 0:3.8.9-1.el7                                                                                                                                                         

Complete!

执行完毕后RabbitMQ就已经安装在系统上

3.使用RabbitMQ

启动RabbitMQ

执行  service rabbitmq-server start命令启动mq
[root@localhost sbin]# service rabbitmq-server start
Redirecting to /bin/systemctl start  rabbitmq-server.service

检查MQ状态

执行 service rabbitmq-server status
[root@localhost sbin]# service rabbitmq-server status
Redirecting to /bin/systemctl status  rabbitmq-server.service
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-10-28 10:24:12 CST; 9s ago
 Main PID: 36086 (beam.smp)
   Status: "Initialized"
   CGroup: /system.slice/rabbitmq-server.service
           ├─36086 /usr/lib64/erlang/erts-10.7.2.5/bin/beam.smp -W w -K true -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 1...
           ├─36194 erl_child_setup 32768
           ├─36221 /usr/lib64/erlang/erts-10.7.2.5/bin/epmd -daemon
           ├─36246 inet_gethost 4
           └─36247 inet_gethost 4

Oct 28 10:24:08 localhost.localdomain rabbitmq-server[36086]: ##########  Licensed under the MPL 2.0. Website: https://rabbitmq.com
Oct 28 10:24:08 localhost.localdomain rabbitmq-server[36086]: Doc guides: https://rabbitmq.com/documentation.html
Oct 28 10:24:08 localhost.localdomain rabbitmq-server[36086]: Support:    https://rabbitmq.com/contact.html
Oct 28 10:24:08 localhost.localdomain rabbitmq-server[36086]: Tutorials:  https://rabbitmq.com/getstarted.html
Oct 28 10:24:08 localhost.localdomain rabbitmq-server[36086]: Monitoring: https://rabbitmq.com/monitoring.html
Oct 28 10:24:08 localhost.localdomain rabbitmq-server[36086]: Logs: /var/log/rabbitmq/rabbit@localhost.log
Oct 28 10:24:08 localhost.localdomain rabbitmq-server[36086]: /var/log/rabbitmq/rabbit@localhost_upgrade.log
Oct 28 10:24:08 localhost.localdomain rabbitmq-server[36086]: Config file(s): (none)
Oct 28 10:24:12 localhost.localdomain rabbitmq-server[36086]: Starting broker... completed with 0 plugins.
Oct 28 10:24:12 localhost.localdomain systemd[1]: Started RabbitMQ broker.

到此rabbitmq服务启动完成。后续章节将会讲解rabbitmq访问Web控制台、rabbitmq管理界面介绍和使用


总结

如果你觉得我写的还行,请关注我的博客并且点个赞哟,也请关注我的公众号,公众号,会定时推送干货以及共享一些优质的学习资料和视频哟.
在这里插入图片描述

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐