0

Hi I have a route that can have multiple servers...

I have tried the following to no luck:

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

This just returns the following error:

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

I am using eureka for most routes, but for this one in particular I cannot use eureka.

Is it possible to get zuul to loadbalance between the two urls?

Solved

The answer below solves this issue with config, however I would mention I was using spring-boot-starter-parent, I also had to upgrade the dependency management to 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>
yongsung.yoon
  • 5,489
  • 28
  • 32
Alex
  • 587
  • 11
  • 31

1 Answers1

3

Yes, you can. Try the following properties instead of yours.

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
yongsung.yoon
  • 5,489
  • 28
  • 32
  • Does this mean I can't use eureka for some and local config for others? - https://github.com/spring-cloud/spring-cloud-netflix/issues/564 – Alex Jun 08 '17 at 08:05
  • The above linked issue is very old question. The above properties works for me. Only example service will work on local config and others will work on eureka. – yongsung.yoon Jun 08 '17 at 08:08
  • hum, if I add ribbon.eureka.enabled=false it works though :/ do you have eureka on your classpath? – Alex Jun 08 '17 at 08:31
  • Sure. I have eureka. Which version of spring cloud are you using ? – yongsung.yoon Jun 08 '17 at 10:27
  • 1.2.3.RELEASE I think will try a newer version – Alex Jun 08 '17 at 12:30
  • 1.1.5.RELEASE is the version, I am using spring-cloud-starter-zuul 1.1.5.RELEASE – Alex Jun 08 '17 at 12:50
  • Probably this feature - specifying NXXXXXClassname with properties - was added from spring-cloud-netflix 1.2.0. Please refer to https://github.com/spring-cloud/spring-cloud-netflix/issues/927 – yongsung.yoon Jun 08 '17 at 12:55