Getting started and installation of RabbitMQ

Getting started and installation of RabbitMQ

RabbitMQ is the most widely deployed open source message broker.RabbitMQ is the most widely deployed open source message broker.
With tens of thousands of users, RabbitMQ is one of the most popular open source message brokers. From T-Mobile to Runtastic, RabbitMQ is used worldwide at small startups and large enterprises.

RabbitMQ is lightweight and easy to deploy on premises and in the cloud. It supports multiple messaging protocols. RabbitMQ can be deployed in distributed and federated configurations to meet high-scale, high-availability requirements.

RabbitMQ runs on many operating systems and cloud environments, and provides a wide range of developer tools for most popular languages.

See how other people are using RabbitMQ:

RabbitMQ is the most widely deployed open source message broker.
RabbitMQ has thousands of users and is one of the most popular open source message brokers. From T-Mobile to Runtastic, RabbitMQ is used by small start-ups and large enterprises worldwide.
RabbitMQ is lightweight and easy to deploy internally and in the cloud. It supports multiple messaging protocols. RabbitMQ can be deployed in distributed and federated configurations to meet large-scale, high-availability requirements.
RabbitMQ can run on many operating systems and cloud environments, and provides a wide range of developer tools for most popular languages.

Brief overview:
RabbitMQ is an open source implementation based on the Erlang language that follows the AMQP protocol and supports multiple clients (languages). It is used to store and forward messages in a distributed system, and has the characteristics of high availability, high scalability, and ease of use.

One, install RabbitMQ

1: Download address: https://www.rabbitmq.com/download.html
2: Environment preparation: CentOS8.x+ / Erlang
RabbitMQ is developed in Erlang language, so the system environment must provide Erlang environment, the first step is to install Erlang

Insert picture description here

Comparison of erlang and RabbitMQ versions: https://www.rabbitmq.com/which-erlang.html
Insert picture description here
Erlang installation

1: install and download

Reference address 1: https://www.erlang-solutions.com/downloads/
Reference address 2: https://www.erlang.org/downloads

method one:

wget https://packages.erlang-solutions.com/erlang-solutions-2.0-1.noarch.rpm
rpm -Uvh erlang-solutions-2.0-1.noarch.rpm

2. Successful installation

yum install -y erlang

Method 2:
Insert picture description here
Insert picture description here
Then

make
make install

Successful installation

erl -v

Install socat

yum install -y socat

Install rabbitmq

Download link: https://www.rabbitmq.com/download.html

Insert picture description here
Download rabbitmq

> wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.13/rabbitmq-server-3.8.13-1.el8.noarch.rpm> rpm -Uvh rabbitmq-server-3.8.13-1.el8.noarch.rpm
yum install rabbitmq-server -y

Insert picture description here
Start rabbitmq service

# 启动服务> systemctl start rabbitmq-server
# 查看服务状态> systemctl status rabbitmq-server
# 停止服务> systemctl stop rabbitmq-server
# 开机启动服务> systemctl enable rabbitmq-server

RabbitMQ configuration

RabbitMQ has a configuration file by default, which defines the relevant configuration information of RabbitMQ, which can meet daily development needs by default. If you need to modify it, you need to create a configuration file to cover it.
Reference official website:
1: https://www.rabbitmq.com/documentation.html
2: https://www.rabbitmq.com/configure.html
3: https://www.rabbitmq.com/configure.html#config -items
4: https://github.com/rabbitmq/rabbitmq-server/blob/add-debug-messages-to-quorum_queue_SUITE/docs/rabbitmq.conf.example

Related ports

5672:RabbitMQ的通讯端口
25672:RabbitMQ的节点间的CLI通讯端口是
15672:RabbitMQ HTTP_API的端口,管理员用户才能访问,用于管理RabbitMQ,需要启动Management插件。
1883,8883:MQTT插件启动时的端口。
61613、61614:STOMP客户端插件启用的时候的端口。
15674、15675:基于webscoket的STOMP端口和MOTT端口

RabbitMQWeb management interface and authorized operation

Management interface
1. By default, rabbitmq does not have a client plug-in installed on the web, and it needs to be installed to take effect.

rabbitmq-plugins enable rabbitmq_management

Note: Rabbitmq has a default account and password: guest By default, it can only be accessed under localhost, so you need to add a remote login user.

After the installation is complete, restart the service.
Remember to open port 15672 in the security group of the corresponding server (Alibaba Cloud, Tencent Cloud, etc.).

Visit
http://ip:15672/ in the browser as follows:
Insert picture description here
authorized account and password
1. Add user

rabbitmqctl add_user admin admin

2. Set user assignment operation authority

rabbitmqctl set_user_tags admin administrator

user level:

1. The administrator can log in to the console, view all information, and manage rabbitmq.
2. The monitoring monitor can log in to the console to view all information.
3. The policymaker can log in to the console and specify the strategy.
4. Managment . Ordinary administrator can log in to the console.

3. Add resource permissions for users

rabbitmqctl.bat set_permissions -p / admin ".*" ".*" ".*"
rabbitmqctl add_user 账号 密码rabbitmqctl set_user_tags 账号 administratorrabbitmqctl change_password Username Newpassword 修改密码rabbitmqctl delete_user Username 删除用户rabbitmqctl list_users 查看用户清单rabbitmqctl.bat set_permissions -p / 用户名 ".*" ".*" ".*" 为用户设置administrator角色rabbitmqctl.bat set_permissions -p / root ".*" ".*" ".*"

Docker installation of RabbitMQ

Docker install RabbitMQ

1. Virtualized container technology-Docker installation

(1)yum 包更新到最新> yum update
(2)安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的> yum install -y yum-utils device-mapper-persistent-data lvm2
(3)设置yum源为阿里云> yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
(4)安装docker> yum install docker-ce -y
(5)安装后查看docker版本> docker -v 
 (6) 安装加速镜像 sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' {  "registry-mirrors": ["https://0wrdwnn6.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker

1-3, install rabbitmq

参考网站:
1:https://www.rabbitmq.com/download.html
2:https://registry.hub.docker.com/_/rabbitmq/

docker run -d --name=rabbit -p 15672:15672 rabbitmq:management

—Hostname: specify the container host name
—name: specify the container name
-p: map the mq port number to the local
or set the user and password at runtime

docker run -d --name myrabbit -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -p 15672:15672 -p 5672:5672 -p 25672:25672 -p 61613:61613 -p 1883:1883 rabbitmq:management

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43803285/article/details/115027292