RabbitMQ introduction and installation

What is MQ?

What is MQ?
MQ (message queue) Literally, the essence of the tower is a queue, except that the content stored in it is a message message, which is a cross-process communication mechanism for transmitting messages, but it is used to transmit messages You only need to rely on MQ, and you don’t need to rely on other services, just like a seckill service. To create an order, I need to rely not only on the order microservice but also on the commodity microservice, but if multiple clients Sending requests at the same time will cause the server to be blocked, and the request will not be completed for a long time, but with the middleware, it can separate the two modules and do its own thing. When it sends the message to the commodity service , is already another request

Why use MQ?

1. Traffic peak reduction
insert image description here
2. Application decoupling
Taking e-commerce applications as an example, there are order systems, inventory systems, logistics systems, and payment systems in the applications. After the user creates an order, if any of the subsystems fails, the order placement operation will be abnormal if the coupling calls the inventory system, logistics system, and payment system. When it is converted to a method based on message queues, the problems of calling between systems will be greatly reduced. For example, the logistics system will take a few minutes to repair due to a failure. During these few minutes, the memory to be processed by the logistics system is cached in the message queue, and the user's order operation can be completed normally. When the logistics system is restored, it is enough to continue processing order information, and mid-order users will not feel the failure of the logistics system, which improves the availability of the system.
3. Asynchronous processing
If your method A suddenly wants to execute method B, the reason for asynchronous processing is that A can continue to do its own thing, and B also executes its own method, and the result is returned to A only after B is completed.

How RabbitMQ works

insert image description here

rabbitmq installation

Step 1: Upload the file
insert image description here
Step 2: Install the file
insert image description here
insert image description here
insert image description here
Step 3:
Add common commands Start the RabbitMQ service Start
insert image description here
the service
insert image description here
Check the service status
insert image description here
Stop the service
insert image description here
Open the web management plug-in
insert image description here

In this way, the browser on the host can access it.
insert image description here
Since there is no permission for the first login, you need to add a new user first.
Create an account
insert image description here
and set user roles
insert image description here
and set user permissions.
insert image description here

Check the role list
insert image description here
and try to log in again
insert image description here

Guess you like

Origin blog.csdn.net/m0_62434717/article/details/130118589