3

I spent all day trying to make Zuul + Eureka work together, but I hasn't been lucky with that. Zuul alone, without Eureka, works fine. I've tried a lot of different configurations like this one, which says that all I have to do is turn Zull in an Eureka client (by using @EnableDiscoveryClient at root application class).

My setup is very simple: it consists of a service:8080 (service 1), Zuul:9000 and Eureka:8761.

All the approaches I've tried using Eureka gave me the same error when I tried to access service 1 using Zull (http://localhost:9000/service1 in this case):

com.netflix.zuul.exception.ZuulException: Forwarding error
(...)
com.netflix.client.ClientException: Load balancer does not have available server for client: service1

Service 1 is working fine (I can access it directly from the browser address bar http://localhost:8080) and Eureka shows both Zull and Service 1 correctly registered:

enter image description here

The apps are configured like:

Service 1 (bootstrap.yml):

spring:
  application:
    name: service1

Service 1 (application.yml):

eureka:
    instance:
        leaseRenewalIntervalInSeconds: 1
        leaseExpirationDurationInSeconds: 2
    client:
        serviceUrl:
            defaultZone: http://127.0.0.1:8761/eureka/

Zuul:

ribbon:
    eureka:
        enabled: false

eureka:
    instance:
        leaseRenewalIntervalInSeconds: 1
        leaseExpirationDurationInSeconds: 2
    client:
        serviceUrl:
            defaultZone: http://127.0.0.1:8761/eureka/
    healthcheck:
        enabled: true

server:
    port: 9000

Eureka:

server:
  port: 8761

eureka:
  client:
    register-with-eureka: false
    fetch-registry: false

logging:
  level:
    com:
      netflix:
        eureka: OFF
        discovery: OFF

Zuul Annotations at root application class:

@EnableZuulProxy
@EnableDiscoveryClient

Am I missing any important point?

Community
  • 1
  • 1
julianobrasil
  • 8,954
  • 2
  • 33
  • 55

0 Answers0