简体   繁体   English

如何跨多个 Kubernetes 集群扩展 RabbitMQ

[英]How to scale RabbitMQ across multiple Kubernetes Clusters

I have an application running in a Kubernetes cluster Azure AKS which is made up of a website running in one deployment, background worker processes running as scheduled tasks in Kubernetes, RabbitMQ running as another deployment and a SQL Azure DB which is not part of the Kubernetes.我有一个在 Kubernetes 集群 Azure AKS 中运行的应用程序,它由在一个部署中运行的网站、在 Kubernetes 中作为计划任务运行的后台工作进程、作为另一个部署运行的 RabbitMQ 和一个不属于 Kubernetes 的 SQL Azure DB 组成.

I would like to deploy achieve load balancing and failover by deploying another kubernetes cluster in another region and placing a Traffic Manager DNS Load Balancer in front of the web site.我想通过在另一个区域部署另一个 kubernetes 集群并在网站前面放置一个流量管理器 DNS 负载平衡器来部署实现负载平衡和故障转移。

The problem that I see is that if the two rabbit instances are in separate kubernetes clusters then items queued in one will not be available in the other.我看到的问题是,如果两个 rabbit 实例位于单独的 kubernetes 集群中,那么在一个中排队的项目在另一个中将不可用。

Is there a way to cluster the rabbitmq instances running in each kubernetes cluster or something besides clustering?有没有办法对在每个 kubernetes 集群中运行的 rabbitmq 实例进行集群,或者除了集群之外的其他东西? Or is there a common design pattern that might avoid problems from having seperate queues?或者是否有一种通用的设计模式可以避免具有单独队列的问题?

I should also note that currently there is only one node running RabbitMq in the current kuberntes cluster but as part of this upgrade it seems like a good idea to run multiple nodes in each cluster which I think the current Helm charts support.我还应该注意,当前 kuberntes 集群中只有一个节点运行 RabbitMq,但作为这次升级的一部分,在每个集群中运行多个节点似乎是个好主意,我认为当前的 Helm 图表支持。

You shouldn't cluster RabbitMQ nodes across regions.你不应该跨区域集群 RabbitMQ 节点。 Your cluster will get split brain because of network delays.由于网络延迟,您的集群将出现脑裂。 To synchronise RabbitMQ queues, exchanges between clusters you can use federation or shovel plugin, depending on your use case.要同步 RabbitMQ 队列、集群之间的交换,您可以使用联邦或 shovel 插件,具体取决于您的用例。

Federation plugin can be enabled on a cluster by running commands:可以通过运行命令在集群上启用联合插件:

rabbitmqctl stop_app
rabbitmq-plugins enable rabbitmq_federation
rabbitmq-plugins enable rabbitmq_federation_management
rabbitmqctl start_app

Mode details on Federation .联邦模式详细信息。

For shovel:对于铲子:

rabbitmq-plugins enable rabbitmq_shovel
rabbitmq-plugins enable rabbitmq_shovel_management
rabbitmqctl stop_app
rabbitmqctl start_app

Mode details on Shovel . Shovel上的模式详细信息。

Full example on how to setup Federation on RabbitMQ cluster can be found here .可以在此处找到有关如何在 RabbitMQ 集群上设置联合的完整示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM