集群中的 RabbitMQ 队列持久化

发布于 2024-09-28 22:00:25 字数 332 浏览 7 评论 0原文

我有一个问题,我似乎无法找到答案。 这是我第一次在“大”应用程序中使用 RabbitMQ,我想知道队列如何在集群中工作。 据我所知,路由信息(队列、交换、绑定)位于集群中的所有节点上,但队列本身驻留在创建它的计算机上。我正在创建一些持久的持久队列。如果我将持久消息写入集群中 MachineA 上的队列,它们会被写入磁盘,然后我将消息写入 MachineB(同一个队列),它们会被“重定向”到 MachineA 还是会被写入 MachineB 的磁盘?

我担心的是我每秒将处理数千条消息,并且不希望磁盘的速度成为瓶颈。如果它确实在内部以某种方式重定向消息,我将不得不实现某种类型的分片,这很糟糕:(

让我知道伙计们:)

I have a question that I cant seem to find an answer on.
This is my first time using RabbitMQ in a "big" application and am wondering how the queues work in a cluster.
I understand that the routing information (queues, exchanges, bindings) is on all nodes in the cluster, but the queue its self resides on the machine that it was created on. I'm creating a few durable persistent queues. If I write persistent messages to a queue on MachineA in the cluster, they get written to disk, then I write messages to MachineB, the same queue, will they be "redirected" to MachineA or will they get written to MachineB's disks?

My concern is I will be handling thousands of messages per sec and dont want to have the speed of disks be a bottle neck. If it does in fact redirect the messages some how internally, I will have to implement some type of sharding which sucks :(

Let me know guys :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

○闲身 2024-10-05 22:00:25

正如您所说,在 RabbitMQ 集群中,队列仅驻留在声明它的节点上。

当您发布到不同节点上的该队列时,消息将被路由到正确的机器,并最终写入磁盘。

这里的关键词是最终。任何消息(无论是在持久队列还是非持久队列上发布的持久消息或瞬态消息)都可能会持久保存到磁盘。发布到持久队列的持久消息只是向代理发出强烈提示,表明该消息应尽快写入磁盘。也就是说,无法保证消息会被写入,因此磁盘通常不会成为瓶颈(例外情况是内存不足时)。

如果您想要有保证的交付,那就是另一个问题了。

As you say, within a RabbitMQ cluster, a queue resides only on the node it was declared on.

When you publish to that queue on a different node, the message is routed to the correct machine, where it eventually gets written to disk.

The key word here is eventually. Any message (whether published persistent or transient, on a durable or non-durable queue) may get persisted to disk. A persistent message published to a durable queue is just a strong hint to the broker that the message should get written to disk ASAP. That said, there's no guarantee that the message will be written, so the disk will not normally become a bottleneck (the exception being if you're running low on memory).

If you want guaranteed delivery, that's a different question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文