2017-06-07 122 views
0

您好我有我曾嘗試以下沒有運氣,可以有多個服務器的路由...zuul多個URL一個路徑

zuul.routes.example.path=/example/** 
zuul.routes.example.serviceId=example 
example.ribbon.eureka.enabled=false 
example.ribbon.eureka.listOfServers=http://127.0.0.1/metrics,http://127.0.0.1/info 

這只是返回以下錯誤:

Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: example

我使用尤里卡爲大多數路線,但對於這一個特別我不能使用尤里卡。

是否有可能讓zuul在兩個url之間進行負載平衡?

解決

下面的答案解決了配置這個問題,不過,我想我是用彈簧引導起動父母提起,我也不得不依賴關係管理升級到Camden.SR7

<dependencyManagement> 
    <dependencies> 
     <dependency> 
     <groupId>org.springframework.cloud</groupId> 
     <artifactId>spring-cloud-dependencies</artifactId> 
<!--   <version>Brixton.SR5</version> --> 
     <version>Camden.SR7</version> 
     <type>pom</type> 
     <scope>import</scope> 
     </dependency> 
    </dependencies> 
    </dependencyManagement> 

回答

2

是的,你可以。嘗試以下屬性而不是你的屬性。

zuul.routes.example.path=/example/** 
zuul.routes.example.serviceId=example 
example.ribbon.NIWSServerListClassName=com.netflix.loadbalancer.ConfigurationBasedServerList 
example.ribbon.listOfServers=http://127.0.0.1/metrics,http://127.0.0.1/info 
+0

不快樂我很害怕,我仍然得到了同樣的錯誤:/ – Alex

+0

這是否意味着我不能使用尤里卡一些和本地配置爲別人? - https://github.com/spring-cloud/spring-cloud-netflix/issues/564 – Alex

+0

上面的鏈接問題是非常古老的問題。以上屬性適用於我。只有示例服務可用於本地配置,其他服務將在尤里卡上運行。 –