ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

RabbitMQ基础知识

2022-06-23 17:31:38  阅读:30  来源: 互联网

标签:00 bp18425116f0cojd1vnz 22 rabbitmq server RabbitMQ 基础知识


RabbitMQ基础知识

一、RabbitMQ概述

RabbitMQ是一款使用Erlang语言开发的,实现AMQP(高级消息队列协议)的开源消息中间件,它具有以下特性

  • 开源、性能优秀,稳定性保障

  • 支持持久化,传输确认,发布确认,可靠性消息投递模式(confirm)、返回模式(return)等保证了MQ的可靠性

  • 集群模式丰富,HA模式,多台RabbitMQ服务器可以组成一个集群,形成一个逻辑Broker

  • 支持多种语言客户端。RabbitMQ几乎支持所有常用编程语言,包括 Java、.NET、Ruby 等

  • 提供多种工作模式,工作模式有:简单模式、工作队列模式、发布订阅模式、路由模式、通配符模式

二、Linux环境下载安装RabbitMQ

1.下载Erlang和RabbitMQ

RabbitMQ是基于Erlang语言开发的,所以在先安装RabbitMQ之前先安装Erlang语言

下载RabbitMQ

2.Linux环境下安装Erlang和RabbitMQ

在Erlang的安装目录下安装Erlang

[root@bp18425116f0cojd1vnz modules]# yum install erlang-23.3.4.11-1.el7.x86_64.rpm
alinux3-updates                                                                                                                       59 kB/s | 4.1 kB     00:00    
alinux3-plus                                                                                                                          96 kB/s | 2.5 kB     00:00    
alinux3-plus                                                                                                                          51 MB/s | 4.9 MB     00:00    
alinux3-powertools                                                                                                                    88 kB/s | 3.0 kB     00:00    
alinux3-os                                                                                                                           154 kB/s | 3.8 kB     00:00    
Docker CE Stable - x86_64                                                                                                             18 kB/s | 3.5 kB     00:00    
Extra Packages for Enterprise Linux Modular 3 - x86_64                                                                                39 kB/s |  10 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                                                                                       178 kB/s | 4.7 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                                                                                        40 MB/s |  11 MB     00:00    

检查Erlang是否安装成功,按两次Ctrl+C退出命令模式

[root@bp18425116f0cojd1vnz bin]# erl -v
Erlang/OTP 23 [erts-11.2.2.10] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]

Eshell V11.2.2.10  (abort with ^G)
1> 
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution

在RabbitMQ的安装目录下安装socat

[root@bp18425116f0cojd1vnz modules]# yum -y install socat
Last metadata expiration check: 0:13:23 ago on Wed 22 Jun 2022 10:58:12 AM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Package socat-1.7.3.3-2.1.al8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

在RabbitMQ的安装目录下RabbitMQ

[root@bp18425116f0cojd1vnz modules]# yum install rabbitmq-server-3.8.34-1.el8.noarch.rpm
Last metadata expiration check: 0:24:38 ago on Wed 22 Jun 2022 10:58:12 AM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Dependencies resolved.
=====================================================================================================================================================================
 Package                                    Architecture                      Version                                  Repository                               Size
=====================================================================================================================================================================
Installing:
 rabbitmq-server                            noarch                            3.8.34-1.el8                             @commandline                             15 M

检查RabbitMQ服务是否安装成功

[root@bp18425116f0cojd1vnz bin]# rpm -qa|grep rabbitmq
rabbitmq-server-3.8.34-1.el8.noarch

启动RabbitMQ服务

[root@bp18425116f0cojd1vnz modules]# systemctl start rabbitmq-server

查看RabbitMQ启动状态

[root@bp18425116f0cojd1vnz bin]# systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2022-06-22 17:18:54 CST; 2s ago
  Process: 3927019 ExecStop=/usr/sbin/rabbitmqctl shutdown (code=exited, status=69)
 Main PID: 3929124 (beam.smp)
   Status: "Initialized"
    Tasks: 21 (limit: 12371)
   Memory: 96.1M
   CGroup: /system.slice/rabbitmq-server.service
           ├─3929124 /usr/lib64/erlang/erts-11.2.2.10/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stb>
           ├─3929139 erl_child_setup 32768
           ├─3929185 inet_gethost 4
           └─3929186 inet_gethost 4

Jun 22 17:18:53 bp18425116f0cojd1vnz rabbitmq-server[3929124]:   TLS Library: OpenSSL - OpenSSL 1.0.2o-fips  27 Mar 2018
Jun 22 17:18:53 bp18425116f0cojd1vnz rabbitmq-server[3929124]:   Doc guides:  https://rabbitmq.com/documentation.html
Jun 22 17:18:53 bp18425116f0cojd1vnz rabbitmq-server[3929124]:   Support:     https://rabbitmq.com/contact.html
Jun 22 17:18:53 bp18425116f0cojd1vnz rabbitmq-server[3929124]:   Tutorials:   https://rabbitmq.com/getstarted.html
Jun 22 17:18:53 bp18425116f0cojd1vnz rabbitmq-server[3929124]:   Monitoring:  https://rabbitmq.com/monitoring.html
Jun 22 17:18:53 bp18425116f0cojd1vnz rabbitmq-server[3929124]:   Logs: /var/log/rabbitmq/rabbit@bp18425116f0cojd1vnz.log
Jun 22 17:18:53 bp18425116f0cojd1vnz rabbitmq-server[3929124]:         /var/log/rabbitmq/rabbit@bp18425116f0cojd1vnz_upgrade.log
Jun 22 17:18:53 bp18425116f0cojd1vnz rabbitmq-server[3929124]:   Config file(s): (none)
Jun 22 17:18:54 bp18425116f0cojd1vnz rabbitmq-server[3929124]:   Starting broker... completed with 3 plugins.
Jun 22 17:18:54 bp18425116f0cojd1vnz systemd[1]: Started RabbitMQ broker.

开启RabbitMQ的Web插件管理

[root@bp18425116f0cojd1vnz modules]# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@bp18425116f0cojd1vnz:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@bp18425116f0cojd1vnz...
Plugin configuration unchanged

服务器测试是否能够访问

[root@bp18425116f0cojd1vnz rabbitmq]# wget http://127.0.0.1:15672
--2022-06-22 17:21:12--  http://127.0.0.1:15672/
Connecting to 127.0.0.1:15672... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2884 (2.8K) [text/html]
Saving to: ‘index.html’

index.html                                100%[==================================================================================>]   2.82K  --.-KB/s    in 0s      

2022-06-22 17:21:12 (384 MB/s) - ‘index.html’ saved [2884/2884]

开放端口访问

[root@bp18425116f0cojd1vnz rabbitmq]# firewall-cmd --zone=public --add-port=5672/tcp --permanent
[root@bp18425116f0cojd1vnz rabbitmq]# firewall-cmd --zone=public --add-port=15672/tcp --permanent

查看开放的端口

firewall-cmd --list-ports

标签:00,bp18425116f0cojd1vnz,22,rabbitmq,server,RabbitMQ,基础知识
来源: https://www.cnblogs.com/yangblogFamily/p/16405873.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有