gpt4 book ai didi

java - Spring AMQP java客户端和RabbitMQ集群节点之间的负载平衡连接?

转载 作者:行者123 更新时间:2023-12-02 05:26:57 24 4
gpt4 key购买 nike

我很清楚 Spring AMQP 支持故障转移,但我的问题是,如何对 RabbitMQ 代理的消费者端和集群节点之间的连接进行负载平衡?

任何回应将不胜感激。

问候。

最佳答案

根据RabbitMQ Clustering Guide :

A client can connect as normal to any node within a cluster. If that node fails and the rest of the cluster survives, then the client should notice the closed connection, and should be able to reconnect to some surviving member of the cluster. Generally, it's not advisable to bake in node hostnames or IP addresses into client applications: this introduces inflexibility and will require client applications to be edited, recompiled and redeployed should the configuration of the cluster change or the number of nodes in the cluster change. Instead, we recommend a more abstracted approach: this could be a dynamic DNS service which has a very short TTL configuration, or a plain TCP load balancer, or some sort of mobile IP achieved with pacemaker or similar technologies. In general, this aspect of managing the connection to nodes within a cluster is beyond the scope of RabbitMQ itself, and we recommend the use of other technologies designed specifically to solve these problems.

另请参阅此答案:RabbitMQ client load balancing .

引用 here :

Create a load balance in front of it and map the backend MQ instance. You can choose either HAProxy or Apache or Nginx or any hardware load balancer you use in your organization.

If the servers are running in AWS inside a VPC, then choose internal load balancer. Update the application to point to the load balancer end point.

正如您所见,互联网上有足够的信息来说明此事。是的,我在这里没有发表我的意见,但看起来实现想要的解决方案没有那么多困难。

只需为 Rabbit 节点配置一些负载平衡器,并为客户端使用其中的 URL。

关于java - Spring AMQP java客户端和RabbitMQ集群节点之间的负载平衡连接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25927372/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com