RabbitMQ基础

2022-05-04 22:21:06 浏览数 (2)

前言

RabbitMQ 是一款开源的消息代理服务器,用来进行信息路由。

MQ可以使架构变得松耦合,从而更有弹性,更灵活,是SOA架构不可或缺的组成部分,担当服务总线或信息总线的角色。

下面分享一下 RabbitMQ 的基础操作,详细可以参阅 官方文档

Tip: 当前版本 RabbitMQ 3.5.6 release


概要


安装

RabbitMQ 是由 Erlang 语言构建的,所以先要安装 Erlang

安装 Erlang

最方便的方式是使用 epel

配置好了epel 软件仓库后,使用如下命令进行安装

代码语言:javascript复制
[root@h102 conf]# yum install erlang.x86_64 
Loaded plugins: dellsysid, fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * epel: ftp.riken.jp
 * extras: centos.ustc.edu.cn
 * updates: mirrors.pubyun.com
Resolving Dependencies
--> Running transaction check
---> Package erlang.x86_64 0:R14B-04.3.el6 will be installed
--> Processing Dependency: erlang-xmerl(x86-64) = R14B-04.3.el6 for package: erlang-R14B-04.3.el6.x86_64
--> Processing Dependency: erlang-wx(x86-64) = R14B-04.3.el6 for package: erlang-R14B-04.3.el6.x86_64
--> Processing Dependency: erlang-webtool(x86-64) = R14B-04.3.el6 for package: erlang-R14B-04.3.el6.x86_64
...
...
--> Processing Dependency: erlang-asn1(x86-64) = R14B-04.3.el6 for package: erlang-R14B-04.3.el6.x86_64
--> Processing Dependency: erlang-appmon(x86-64) = R14B-04.3.el6 for package: erlang-R14B-04.3.el6.x86_64
--> Running transaction check
---> Package erlang-appmon.x86_64 0:R14B-04.3.el6 will be installed
---> Package erlang-asn1.x86_64 0:R14B-04.3.el6 will be installed
---> Package erlang-common_test.x86_64 0:R14B-04.3.el6 will be installed
...
...
--> Processing Dependency: libtcl8.5.so()(64bit) for package: 1:tk-8.5.7-5.el6.x86_64
---> Package unixODBC.x86_64 0:2.2.14-14.el6 will be installed
---> Package wxGTK-gl.x86_64 0:2.8.12-1.el6.centos will be installed
--> Running transaction check
---> Package tcl.x86_64 1:8.5.7-6.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                                 Arch                    Version                                Repository               Size
======================================================================================================================================
Installing:
 erlang                                  x86_64                  R14B-04.3.el6                          epel                     26 k
Installing for dependencies:
 erlang-appmon                           x86_64                  R14B-04.3.el6                          epel                    145 k
 erlang-asn1                             x86_64                  R14B-04.3.el6                          epel                    993 k
 erlang-common_test                      x86_64                  R14B-04.3.el6                          epel                    508 k
 ...
 ...
 tcl                                     x86_64                  1:8.5.7-6.el6                          base                    1.9 M
 tk                                      x86_64                  1:8.5.7-5.el6                          base                    1.4 M
 unixODBC                                x86_64                  2.2.14-14.el6                          base                    378 k
 wxGTK-gl                                x86_64                  2.8.12-1.el6.centos                    extras                   31 k

Transaction Summary
======================================================================================================================================
Install      62 Package(s)

Total download size: 38 M
Installed size: 72 M
Is this ok [y/N]: y
Downloading Packages:
(1/62): erlang-R14B-04.3.el6.x86_64.rpm                                                                        |  26 kB     00:00     
(2/62): erlang-appmon-R14B-04.3.el6.x86_64.rpm                                                                 | 145 kB     00:02     
(3/62): erlang-asn1-R14B-04.3.el6.x86_64.rpm                                                                   | 993 kB     00:18     
...
...
(60/62): tk-8.5.7-5.el6.x86_64.rpm                                                                             | 1.4 MB     00:00     
(61/62): unixODBC-2.2.14-14.el6.x86_64.rpm                                                                     | 378 kB     00:00     
(62/62): wxGTK-gl-2.8.12-1.el6.centos.x86_64.rpm                                                               |  31 kB     00:00     
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                  76 kB/s |  38 MB     08:34     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : erlang-crypto-R14B-04.3.el6.x86_64                                                                                1/62 
  Installing : erlang-erts-R14B-04.3.el6.x86_64                                                                                  2/62 
  Installing : erlang-kernel-R14B-04.3.el6.x86_64                                                                                3/62 
...
...
  Verifying  : erlang-dialyzer-R14B-04.3.el6.x86_64                                                                             60/62 
  Verifying  : erlang-snmp-R14B-04.3.el6.x86_64                                                                                 61/62 
  Verifying  : erlang-cosEvent-R14B-04.3.el6.x86_64                                                                             62/62 

Installed:
  erlang.x86_64 0:R14B-04.3.el6                                                                                                       

Dependency Installed:
  erlang-appmon.x86_64 0:R14B-04.3.el6                              erlang-asn1.x86_64 0:R14B-04.3.el6                               
  erlang-common_test.x86_64 0:R14B-04.3.el6                         erlang-compiler.x86_64 0:R14B-04.3.el6                           
 ...
 ...                               
  erlang-xmerl.x86_64 0:R14B-04.3.el6                               tcl.x86_64 1:8.5.7-6.el6                                         
  tk.x86_64 1:8.5.7-5.el6                                           unixODBC.x86_64 0:2.2.14-14.el6                                  
  wxGTK-gl.x86_64 0:2.8.12-1.el6.centos                            

Complete!
[root@h102 conf]# echo $?
0
[root@h102 conf]# 

0 人点赞