【问题标题】:difference between eureka ID and service ID in spring cloud app?spring cloud app中eureka ID和service ID的区别?
【发布时间】:2015-08-27 00:13:19
【问题描述】:

我正在阅读有关为 Spring Cloud 应用程序启用 ZuulProxydocumentation

开头如下:

By convention, a service with the Eureka ID "users", will receive requests from the proxy located at /users

然后在文档中,它如下所示

To get more fine-grained control over a route you can specify the path and the serviceId independently:

application.yml
 zuul:
  routes:
    users:
      path: /myusers/**
      serviceId: users_service
This means that http calls to "/myusers" get forwarded to the "users_service" service. The route has to have a "path" which can be specified as an ant-style pattern, so "/myusers/*" only matches one level, but "/myusers/**" matches hierarchically.

这里引用了 serviceID。我现在很困惑?以上application.yml中的usersusers_service是什么。

据我了解,每个向 Eureka 注册的微服务应用都在bootstrap.yml 中提供如下名称:例如,

spring:
  application:
    name: user

我的理解是 user 现在是 Eureka ID 以及服务 ID。那么上面的usersusers_service是什么意思呢?

【问题讨论】:

    标签: spring spring-boot spring-cloud


    【解决方案1】:

    按照惯例,Eureka ID 为“users”的服务将接收来自位于 /users 的代理的请求

    在这种情况下,Eureka ID 指的是service ID - 这两个术语都在文档中使用。

    默认spring.application.name用于Eureka客户端中eureka ID的初始值。

    结论:是的,你的理解是对的。

    【讨论】:

    • 我的问题是上述 application.yml 中的 usersusers_sevice 是什么。它们在哪里配置?
    • zuul.routes.users 是 serviceId,除非有 serviceId 属性。否则它只是地图中的一个键。
    猜你喜欢
    • 2018-08-25
    • 1970-01-01
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多