简体   繁体   English

Netflix Eureka 服务器可以用作微服务环境之间的代理吗?

[英]Can Netflix Eureka server be used as a proxy between microservices environments?

Thanks in advance everyone looking at this!提前感谢所有关注这个的人!
Here is what I'm trying to do:这是我正在尝试做的事情:
I am developing microservices using Spring-Boot/Java with Zuul and Eureka as gateway and registry respectively.我正在使用 Spring-Boot/Java 开发微服务,Zuul 和 Eureka 分别作为网关和注册表。 The problem I'm having is that I want to develop my new microservice locally but still be able to make calls to my other existing microservices running on a remote cluster.我遇到的问题是我想在本地开发我的新微服务,但仍然能够调用我在远程集群上运行的其他现有微服务。 My thinking is that I can run Eureka locally and using its peering capability to forward failed local requests to the Eureka server that lives in the remote cluster.我的想法是我可以在本地运行 Eureka,并使用其对等功能将失败的本地请求转发到位于远程集群中的 Eureka 服务器。

My question:我的问题:
Is it possible to configure Eureka to register local services on my workstation but also forward/failover to a remote Eureka peer so that I am hitting the correct remote gateway for all my other remote microservices?是否可以将 Eureka 配置为在我的工作站上注册本地服务,但也可以转发/故障转移到远程 Eureka 对等方,以便我为所有其他远程微服务点击正确的远程网关?

This should be achievable by using Zones:这应该可以通过使用区域来实现:

https://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/2.2.2.RELEASE/reference/html/#zones https://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/2.2.2.RELEASE/reference/html/#zones

In order for that to work, you'd need to have the Eureka servers see eachother as peers.为了使其工作,您需要让 Eureka 服务器将彼此视为对等点。 The official docs for that are here:官方文档在这里:

https://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/2.2.2.RELEASE/reference/html/#spring-cloud-eureka-server-peer-awareness https://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/2.2.2.RELEASE/reference/html/#spring-cloud-eureka-server-peer-awareness

You can configure your services to prefer a certain zone.您可以将服务配置为首选某个区域。

// Config for your production services
eureka.instance.metadataMap.zone = production
eureka.client.preferSameZoneEureka = true

// Config for your local services
eureka.instance.metadataMap.zone = local
eureka.client.preferSameZoneEureka = true  

So any service you are running locally will be preferred but it will fall-back to the other zone if the service you call upon isn't running locally.因此,您在本地运行的任何服务都将是首选,但如果您调用的服务未在本地运行,它将回退到另一个区域。

Note : It is possible this way for a "production" instance to call your local instance if there are no instances of a given service running in the production cluster but you happen to be running them locally.注意:如果生产集群中没有运行给定服务的实例但您碰巧在本地运行它们,则“生产”实例可以通过这种方式调用您的本地实例。

暂无
暂无

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

相关问题 Netflix eureka客户端微服务未在eureka服务器上注册 - Netflix eureka client micro-service is not registering with eureka server 运行 eureka server 和 eureka client 连接多个微服务后出错 - error after running eureka server and eureka client for connecting multiple microservices Spring Cloud NetFlix Eureka Server-启动时出现tomcat错误 - Spring cloud netflix eureka server - tomcat error on startup 在启动时通过Netflix Eureka Discovery实现Spring Cloud Config Server循环依赖 - Spring Cloud Config Server Circular Dependency With Netflix Eureka Discovery on Startup Netflix eureka微服务 - Netflix eureka Microservice 如何使用Netflix / Eureka执行故障转移? - How to perform a failover with Netflix/Eureka? 如何在一个 Spring Boot 应用程序中的不同端口上运行 api-gateway(Netflix Zuul) 和 Eureka Server - How to run api-gateway(Netflix Zuul) and Eureka Server on different port in one Spring Boot application Netflix Eureka Server 未使用 JDK 11 作为 Spring-Boot 应用程序启动。 但同样是在 JDK1.8 上运行 - Netflix Eureka Server Not starting as Spring-Boot Application with JDK 11 . But same is running with JDK1.8 与netflix Eureka一起使用spring-cloud时,如何让Discovery Client工作? - How can I get the Discovery Client working when using spring-cloud together with netflix Eureka? 如何使用Netflix eureka和功能区按版本查找服务 - How to locate services by version with Netflix eureka and ribbon
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM