首页 文章

在Google Cloud中集群Eureka服务器

提问于
浏览
0

我们使用Spring Cloud Netflix Eureka进行服务注册 . 我们将在GCP(Google Cloud)中部署所有微服务 .

Environment

  • 我们将Eureka服务器作为集群运行 .

  • Eureka Server将自己注册为application.properties中对等体的客户端

eureka.client.service-url.default-zone = http://xx.xx.xx.xxx:8762 / eureka

  • 客户端微服务通过在application.properties中提供Eureka Server IP来注册/注册自己

eureka.client.service-url.default-zone = http://xx.xx.xx.xxx:8761:/ eureka,http://xx.xx.xx.xxx:8762:/ eureka

Since IP Address and hostnames are dynamic in cloud, can we configure Eureka Servers in cluster without using ipaddress/hostname.

请提供在Google Cloud中使用的示例配置 .

1 回答

  • 0

    我没有使用过GCP,但已经在PCF上实现并部署了spring cloud(在更高层次上,它与GCP几乎相同) .

    你不能让 defaultZone 完全动态 . 为什么?因为这些特性在应用程序启动期间被选中 .

    您的架构中需要有一些东西(某些服务或数据库)告诉您的服务其他服务的动态主机名/ IP地址 . 那是你的情况下的Eureka服务器 . 所有服务都需要知道Eureka服务的地址(主机名/ IP地址) . 现在,如果Eureka服务器的主机名是动态的,那么当主机名更改时,您的服务如何知道Eureka服务器的新主机名?

    您只需手动更新Eureka服务器的地址 . 您可以做的最多是将 defaultZone 外部化到集中式配置服务器(或类似的东西) . 这样你就不得不在一个地方更新新地址 .

相关问题