Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1011178l opened this issue Nov 6, 2018 · 12 comments

Comments

@1011178l
Copy link

1011178l commented Nov 6, 2018

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
Copy link
Author

1011178l commented Nov 6, 2018

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

@1011178l 1011178l changed the title Load balancer does not have available server for client "Load balancer does not have available server for client". Is this a bug or my config was wrong? Nov 7, 2018
@senyoAsamoah
Copy link

for your zuul application.yml fetch the registry as below

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: true

@1011178l
Copy link
Author

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

@senyoAsamoah
Copy link

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

@Luolanjiao
Copy link

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

@Luolanjiao
Copy link

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
Copy link

for your zuul application.yml fetch the registry as below

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: true

That solved my problem.

@frangel02
Copy link

Configurations Basic Eureka Client

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

@tan-i-ham
Copy link

for your zuul application.yml fetch the registry as below

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: true

this solved my problem, too.

@super-404
Copy link

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

Copy link

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.

@github-actions github-actions bot added the Stale label Oct 21, 2024
@Luolanjiao
Copy link

Luolanjiao commented Oct 21, 2024 via email

@github-actions github-actions bot removed the Stale label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants