Several questions related to RabbitMQ


1. What are the usage scenarios of RabbitMQ?

1. Panic buying activities, cutting peaks and filling valleys
2. Delaying information processing
3. Decoupling systems, separating various services through a publish-subscribe model.

2. What are the important roles of RabbitMQ?

There are three main roles: producer, consumer, agent
1. Producer: responsible for the generation and release of information
2. Consumer: responsible for the reception and processing of information
3. Agent: RabbitMQ itself, which is mainly responsible for similar to "express" Work, save the information released by the producer, and then send it to the consumer

3. What are the important components of RabbitMQ?

1. Connectionfactory (connection manager): the connection manager established between the application and RabbitMQ, used in the program code.
2. Channel: The channel used for message push.
3. Exchange: used to receive and distribute messages.
4. Queue: used to store messages from producers.
5. Routingkey (routing key): used to distribute the producer's data to the switch.
6. BindingKey (binding key): used to bind the exchange's message to the queue.

Fourth, what is the role of vhost in RabbitMQ?

There are many vhosts in each RabbitMQ, which we call virtual hosts. It is a mini RabbitMQ, which has its own queues, switches and bindings, and has an independent authority mechanism.

5. How are RabbitMQ messages sent?

First, the client needs to establish a TCP connection with the RabbitMQ server, and then after passing the authentication, an amqp channel will be formed between the two, and the channel number is unique. Then the publishing and subscribing of messages can be completed in the channel.

6. How does RabbitMQ ensure the stability of messages?

1. It provides the function of transaction.
2. Set the channel to confirm (confirm) mode.

7. How does RabbitMQ avoid message loss?

1. Make the message persistent on the disk to prevent the message in the memory from being lost after the server restarts.
2. Each message contains at least one physical disk to ensure that the message falls on the disk.

8. What are the conditions for RabbitMQ to ensure successful message persistence?

1. The statement queue must be set to be persistent (durable is set to true)
2. The message push delivery mode must be set to be persistent (deliveryMode is set to 2)
3. The message has reached the persistent exchange
4. The message has reached the persistent queue
as long as Achieve the above four conditions, you can ensure that the message persists into

9. What are the disadvantages of RabbitMQ persistence?

The persistence processing scheme of RabbitMQ is to store the message in the disk, so it will reduce the throughput of the server. The use of SSD solid state drives can effectively alleviate this problem.

10. How many types of broadcasts does RabbitMQ have?

There are four main types:
1. Direct: The default type of RabbitMQ is the normal publish-and-subscribe mode. As long as a message sent by a message publisher is subscribed by a message subscriber, the message will be cleared out of the message queue. Others Subscribers can no longer subscribe to the message. This means that a message can only be used once.
2. Header: This mode is similar to the direct mode, but the performance is poor, so it is generally not used much.
3. Fanout: This mode is a distribution mode. In this mode, the message published by the publisher will be received by all subscribers.
4. Topic: This mode is a matching subscription mode. The message published by the publisher is matched to all eligible message subscribers through regular expressions, and then the message is sent to them.

11. How does RabbitMQ implement delayed message queues?

After the message expires, it enters the dead letter exchange, and then is forwarded to the delayed consumption queue by the exchange to realize the delay function;
use the RabbitMQ-delayed-message-exchange plug-in to realize the delay function

12. What is the use of RabbitMQ cluster?

The cluster mainly has the following two purposes:
high availability: a certain server has a problem, the entire RabbitMQ can still be used;
high capacity: the cluster can carry more messages.

13. What are the types of RabbitMQ nodes?

There are two main types of nodes:
1. Disk nodes: storing messages in disk is a necessary choice for RabbitMQ message persistence.
2. Memory node: Put the message in the memory, the reading speed is relatively fast.

14. What issues should be paid attention to when building a RabbitMQ cluster?

1. Each RabbitMQ must be connected with "–link".
2. The erlang cookie attribute configuration in each RabbitMQ must be consistent. This attribute is the authentication key between each RabbitMQ. Only if it is consistent, each RabbitMQ can communicate and share information with each other.
3. There must be a disk node in the cluster to prevent the loss of messages.

15. Is each node of RabbitMQ a complete copy of other nodes? why?

It is not a complete copy of other nodes.
If each node is a complete copy of other nodes, then the upper limit of the information stored is equivalent to the amount of information storage of only one RabbitMQ, and the performance can only maintain the same performance as a single node or even worse, so that it cannot be used. Clustering can bring two advantages: the increase in message capacity and the increase in message processing capabilities.

16. What happens if the only disk node in the RabbitMQ cluster crashes?

The only disk node crashed, the cluster can still be used, but no operations can be performed on the cluster.

17. Does RabbitMQ have any requirements for the stopping order of cluster nodes?

If required, you must first stop the memory node in the RabbitMQ cluster, and then stop the disk node, so as to ensure that the message is not lost.

Guess you like

Origin blog.csdn.net/qq_42697271/article/details/113921930