RabbitMQ-Introduction to mirror queue configuration

不言
Release: 2023-04-05 12:44:01
forward
2168 people have browsed it

This article brings you an introduction to RabbitMQ-mirror queue configuration. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Set policy method

RabbitMQ-Introduction to mirror queue configuration

For example, we set the queue that satisfies the rule "*_mirrored_queue" as a mirror queue
./ rabbitmqctl set_policy -p wenda-action mirrored_queue_policy_all ".*_mirrored_queue" '{"ha-mode":"all"}'
All queues that meet the "*_mirrored_queue" rule applied after are mirrored queues

tips: Testing shows that you can set up a mirror queue using the regular rules of the policy. If the policy is not set, the mirror queue set using the x-ha-policy parameter when declaring the queue (queue_declare method) is invalid. If the policy regular rules are set and the x-ha-policy parameter is not used, the queue that meets the regular rules will automatically become a mirror queue. (Many blogs explain how to use the x-ha-policy parameter of the queue to set the mirror queue. But it does not specify that policy rules need to be created in advance).

rabbitmq documentation description:

RabbitMQ-Introduction to mirror queue configuration

#Synchronization mechanism of mirror queue

When a queue is declared as a mirror queue , and ha-mode:all, all nodes in the cluster will have a mirror of the queue. When the queue already has some data, add a new node to the cluster. After the new node joins the cluster, a mirror of the queue will be automatically created, but The queue had data before. Should the data be synchronized to the new node immediately or manually? At this time, the synchronization mechanism of the mirror queue is required.
The arg parameter in the queue_declare() method has this configuration:
ha-sync-mode manual manual synchronization | automatic automatic synchronization

tips: When a queue is being synchronized, all operations to change the queue will be blocked, which may be blocked for minutes, hours or even days due to various reasons. (So ​​be careful when synchronizing queues)

The above is the detailed content of RabbitMQ-Introduction to mirror queue configuration. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!