Replies: 7 comments 2 replies
-
My purpose is to load balance the message node with multiple rabbbitmq pod |
Beta Was this translation helpful? Give feedback.
-
I tried with [rabbitmq_sharding], i have three node The following code could not work, how could i consume all the partition on different node |
Beta Was this translation helpful? Give feedback.
-
You can publish to an exchange from any node in the cluster. In the same way, you can consume from a queue from any node in the cluster. If your queue leader is in, let's say, node-1, and your consumer is connected to node-2 or node-3, the message will be forwarded internally and delivered to the consumer, in the appropriate node. This, and other topics, are covered in the clustering guide in our docs. If you want to use queue sharding, you must have one consumer per shard. If a single consumer were to consume from all the shards, it won't be distributing the load at all :-) I'd recommend that you read the readme in the queue shard plugin. I don't know excatly what you are trying to achieve, but if data safety and availability are important to your use case, I'd recommend using Quorum Queues, instead of classic queues. Quorum queues have 3 replicas by default, they persist every message to disk, and they are tolerant to node failures. |
Beta Was this translation helpful? Give feedback.
-
my purpose is to improve the consume speed, it is not perfect to have one consumer per shard. is there any other solution? |
Beta Was this translation helpful? Give feedback.
-
Generally speaking, having one queue will be your limitation, so make sure you really need one.
This has little to do with Cluster Operator though. If you want to discuss this further, I'd recommend starting a discussion on the mailing list or rabbitmq-server repo and please provide more data about you use case, current throughput you see and throughput you'd expect. |
Beta Was this translation helpful? Give feedback.
-
i tried to use shard to improve the throughput, but when i have multiple pods, it could not consume the queue with the queue name For example, the queue name is testing, i have one shard on each pod, like |
Beta Was this translation helpful? Give feedback.
-
@Zerpet Thanks very much for your info, finally it works. But the queue type created automatically with sharding is "Classical", could we change the queue type to "Quorum"? |
Beta Was this translation helpful? Give feedback.
-
Dear expert,
In my k8s env, we have:
We found that the queue are bind to rabbit@my-rabbitmq-0.my-rabbitmq-headless.default.svc.cluster.local. According to my understanding, the message could reach all the 3 pods, but now we only have one queue on a specific pod, will all the pods put the messages to this queue?
Very appreciated for your response!
Thanks,
Jason
Beta Was this translation helpful? Give feedback.
All reactions