2015-08-27 57 views
0

我正在通過documentation閱讀關於爲彈簧雲應用啓用ZuulProxy的信息。春季雲應用中尤里卡ID和服務ID之間的區別?

它開始爲以下幾點:

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. 

這裏服務ID被稱爲。我現在很困惑?以上application.yml中的usersusers_service是什麼。

據我的理解去,與尤里卡每個微服務應用程序寄存器提供了一個名稱爲bootstrap.yml如下:例如,

spring: 
    application: 
    name: user 

我的理解是,user現在是Eureka ID以及服務ID。那麼usersusers_service在上面是什麼意思呢?

回答

1

按照慣例,與尤里卡ID「用戶」,會從位於代理接收請求服務/用戶

在這種情況下,Eureka IDservice ID - 這兩個詞是通過使用文檔。

默認情況下,spring.application.name用於Eureka客戶端中eureka ID的初始值。

結論:是的,你對你的理解是正確的。

+0

我的問題是上面描述的application.yml中的'users'和'users_sevice'。他們在哪裏配置? –

+0

'zuul.routes.users'是serviceId,除非有'serviceId'屬性。否則,它只是地圖上的一把鑰匙。 – spencergibb

相關問題