rabbitmq 的缩放

scaling of rabbit mq

如果 rabbitMQ 指标达到阈值,我们可以使用哪些扩展选项?我有一个虚拟机,上面安装了 RabbitMQ 运行。如果队列长度> 队列总长度的 90%,我们是否可以将实例计数增加 1 并使用单独的队列,以便按优先级处理它们?

简而言之,根据 RabbitMQ 的不同参数,我们有哪些扩展选项

看看RabbitMQ Sharding Plugin

来自他们的自述文件:

RabbitMQ Sharding Plugin

This plugin introduces the concept of sharded queues for RabbitMQ. Sharding is performed by exchanges, that is, messages will be partitioned across "shard" queues by one exchange that we should define as sharded. The machinery used behind the scenes implies defining an exchange that will partition, or shard messages across queues. The partitioning will be done automatically for you, i.e: once you define an exchange as sharded, then the supporting queues will be automatically created on every cluster node and messages will be sharded across them.

Auto-scaling

One interesting property of this plugin, is that if you add more nodes to your RabbitMQ cluster, then the plugin will automatically create more shards in the new node. Say you had a shard with 4 queues in node a and node b just joined the cluster. The plugin will automatically create 4 queues in node b and join them to the shard partition. Already delivered messages will not be rebalanced, but newly arriving messages will be partitioned to the new queues.