简体   繁体   English

spring-cloud 环境中的分布式 Rabbitmq

[英]Distributed Rabbitmq within a spring-cloud environment

I am trying to setup a distributed system based on current spring-cloud release (meaning mostly Netflix OSS) using the following components我正在尝试使用以下组件基于当前的 spring-cloud 版本(主要是 Netflix OSS)设置分布式系统

  • 1 or more cloud config servers 1 个或多个云配置服务器
  • 1 or more Eureka servers 1 个或多个 Eureka 服务器
  • 1 or more services using Eureka and Config Server clients 1 个或多个使用 Eureka 和 Config Server 客户端的服务

The setup above is easy enough to get going however once you start looking into setting up so that configuration changes in the cloud Config servers automatically trigger changes in the values of the actual clients, things start getting more complicated.上面的设置很容易开始,但是一旦你开始考虑设置,以便云配置服务器中的配置更改自动触发实际客户端值的更改,事情开始变得更加复杂。

It is my understanding that for such a feature to work one should introduce spring-cloud-bus clients to the services which in turn will use, currently the only supported implementation, rabbitmq servers (the actual rabbitmq binaries and not some spring-boot app like eureka or Config servers) to allow change events in the Config server to be propagated to the clients automatically.我的理解是,为了让这样的功能起作用,应该将 spring-cloud-bus 客户端引入服务,这些服务反过来将使用,目前唯一支持的实现,rabbitmq 服务器(实际的 rabbitmq 二进制文件,而不是一些 spring-boot 应用程序,如eureka 或 Config 服务器)以允许 Config 服务器中的更改事件自动传播到客户端。

It sounds counterintuitive to setup such a system and have to hardcode addresses to rabbitmq servers in the clients (even if one will be keeping the amount of rabbitmq servers more or less static).设置这样一个系统并且必须将地址硬编码到客户端中的rabbitmq 服务器听起来违反直觉(即使人们将或多或少保持rabbitmq 服务器的数量不变)。

How is one supposed to register rabbitmq server instances in the Eureka service discovery server(s) to allow for clients to find them without having to have any knowledge about their location prior to startup?应该如何在 Eureka 服务发现服务器中注册 rabbitmq 服务器实例,以允许客户端在启动之前无需了解其位置即可找到它们?

I cannot seem to find any documentation on how this is done given that rabbitmq is not a spring-cloud component.鉴于rabbitmq不是spring-cloud组件,我似乎找不到任何关于如何完成的文档。 In fact very little documentation seems to exist regarding on how the rabbitmq + eureka + spring-cloud-bus should be setup together.事实上,关于如何将rabbitmq + eureka + spring-cloud-bus 设置在一起的文档似乎很少。

I know that I am on a VERY old question, even though I think it worth a comment for people who read this in the future.我知道我在问一个非常古老的问题,尽管我认为对于将来阅读此内容的人来说值得发表评论。

Most of the cloud services, lets take AWS as an example, have an Elastic IP solution - so you can configure IPs for RabbitMQ servers, and the IPs always belong to the RabbitMQ, no matter whether the instances change.大多数云服务,以AWS为例,都有弹性IP方案——可以为RabbitMQ服务器配置IP,无论实例是否变化,IP始终属于RabbitMQ。 You can re-attach the Elastic IP to different instances.您可以将弹性 IP 重新附加到不同的实例。

It works nearly the same with Elastic Load Balancer , which keeps its IP, so you could configure your microservices to a specific IP using Spring Cloud Config Server - and scale the RabbitMQ instances without a need to worry about configuration change.它与Elastic Load Balancer几乎相同,它保留其 IP,因此您可以使用 Spring Cloud Config Server 将微服务配置为特定 IP - 并扩展 RabbitMQ 实例而无需担心配置更改。

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

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