Netflix / zuul

Zuul is a gateway service that provides dynamic routing, monitoring, resiliency, security, and more.
Apache License 2.0
13.55k stars 2.39k forks source link

"Load balancer does not have available server for client". Is this a bug or my config was wrong? #532

Open 1011178l opened 6 years ago

1011178l commented 6 years ago

I noticed that many people asked the same question, But I tried their ways, but my problem is still there.

I use spring-boot + eureka + zuul,

spring.cloud.version: 2.0.2.RELEASE

Here is the Eureka server:

@SpringBootApplication
@EnableEurekaServer
@Slf4j
public class EurekaServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaServerApplication.class, args);
        log.info("-- EurekaServerApplication started --");
    }
}

and the application.yml for eureka server:

server:
port: 8888

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: false
    healthcheck:
      enabled: true
    service-url:
      defaultZone: http://localhost:8888/eureka

Then here is the Zuul server:

@SpringBootApplication
@EnableZuulProxy
@EnableEurekaClient
@Slf4j
public class ZuulServerApplication{

    public static void main(String[] args) {
        SpringApplication.run(ZuulServerApplication.class, args);
        log.info("-- ZuulServerApplication started --");
    }
}

and the application.yml for Zuul

server:
  port: 7777

eureka:
  instance:
    appname: zuul-server
  client:
    serviceUrl:
    defaultZone: http://localhost:8888/eureka

zuul:
  ignoredServices: '*'
  routes:
    file-management:
      path: /file-management/**
      serviceId: file-management

and a microservice file-management:

@SpringBootApplication
@EnableEurekaClient
@EnableSwagger2
@Slf4j
public class FileManagementApplication {
    public static void main(String[] args) {
        SpringApplication.run(FileManagementApplication.class, args);
        log.info("-- FileManagement started --");
    }
}

application.yml

... some other configs
server:
  port: 8081
eureka:
  instance:
    appname: file-management
  client:
    serviceUrl:
    defaultZone: http://localhost:8888/eureka

I have this problem for a couple of days, Any help would be great appreciated!

1011178l commented 6 years ago

After I did a basic debug, I find the allServerList in the class BaseLoadBalancer is null. Not sure if this info is useful.

senyoAsamoah commented 5 years ago

for your zuul application.yml fetch the registry as below

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: true
1011178l commented 5 years ago

@senyoAsamoah Thanks. Can I manully define route rather than use fetchRegistry?

senyoAsamoah commented 5 years ago

You can manually define, just use the url field in the routes definition for zuul

Luolanjiao commented 5 years ago

hi,I have the same question to yours.do you haven solved it ,please?

Luolanjiao commented 5 years ago

I got it ! you could check out your maven file that must imput the "spring-cloud-starter-netflix-eureka-client",not the "spring-cloud-netflix-eureka-client".because the "spring-cloud-starter-netflix-eureka-client" include ribbon-eureka,but the other one is not . with ribbon-eureka ,it can do the balance.^_^

JohnneSouza commented 4 years ago

for your zuul application.yml fetch the registry as below

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: true

That solved my problem.

frangel02 commented 4 years ago

Configurations Basic Eureka Client

only set this -> eureka.client.enabled=false in the microservice That solved my problem.

tan-i-ham commented 4 years ago

for your zuul application.yml fetch the registry as below

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: true

this solved my problem, too.

super-404 commented 4 years ago

I got it ! you could check out your maven file that must imput the "spring-cloud-starter-netflix-eureka-client",not the "spring-cloud-netflix-eureka-client".because the "spring-cloud-starter-netflix-eureka-client" include ribbon-eureka,but the other one is not . with ribbon-eureka ,it can do the balance.^_^

ncie,thank you

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Luolanjiao commented 1 month ago

您好,您的邮件已收到,谢谢!