gs-spring-cloud-loadbalancer icon indicating copy to clipboard operation
gs-spring-cloud-loadbalancer copied to clipboard

Request to check using '.withHealthChecks()' on Custom loadbalancer configuration

Open 00azzurri3 opened this issue 4 years ago • 2 comments

I have trouble with health-check with custom loadbalancer configuration from "say-hello" and "user" modules from 'complete' folder here.

Can you please check if I have miss something? Or do I need to set more configuration for using '.withHealthChecks()'?

Let me share how I tested.

  1. Download "complete" folder and run "say-hello" with port 8090 and run "user" with port 8888.

  2. Try accessing to "user" : http://localhost:8888/hi

  3. Access localhost:8090, localhost:9092, localhost:8099 following RoundRobin rule (port 8090, 9092, 8099 described on 'https://github.com/spring-guides/gs-spring-cloud-loadbalancer/blob/main/complete/user/src/main/java/hello/SayHelloConfiguration.java')

  4. Modify custom config like below from the file 'https://github.com/spring-guides/gs-spring-cloud-loadbalancer/blob/main/complete/user/src/main/java/hello/SayHelloConfiguration.java'.

    @Bean @Primary ServiceInstanceListSupplier serviceInstanceListSupplier( ConfigurableApplicationContext context ) { // return new DemoServiceInstanceListSuppler("say-hello"); return ServiceInstanceListSupplier.builder() .withBase(new DemoServiceInstanceListSuppler("say-hello")) .withHealthChecks() .build(context); }

  5. Run "user" again and try accessing to "user".

  6. Got the error log and can not access to "say-hello".

2021-05-07 11:31:55.619 WARN 63497 --- [ parallel-5] o.s.c.l.core.RoundRobinLoadBalancer : No servers available for service: localhost 2021-05-07 11:31:55.619 WARN 63497 --- [ parallel-5] eactorLoadBalancerExchangeFilterFunction : LoadBalancer does not contain an instance for the service localhost 2021-05-07 11:31:55.619 WARN 63497 --- [ parallel-5] o.s.c.l.core.RoundRobinLoadBalancer : No servers available for service: localhost 2021-05-07 11:31:55.620 WARN 63497 --- [ parallel-5] eactorLoadBalancerExchangeFilterFunction : LoadBalancer does not contain an instance for the service localhost 2021-05-07 11:31:55.620 WARN 63497 --- [ parallel-5] o.s.c.l.core.RoundRobinLoadBalancer : No servers available for service: localhost 2021-05-07 11:31:55.620 WARN 63497 --- [ parallel-5] eactorLoadBalancerExchangeFilterFunction : LoadBalancer does not contain an instance for the service localhost

00azzurri3 avatar May 07 '21 02:05 00azzurri3

I am also facing similar issue. With custom loadbalancer configuration unable to do healthcheck. In yml, if i give healthcheck it works. But I have to use custom loadbalancer configuration class as I am using custom loadbalancer rule

neelimaj97 avatar Sep 30 '21 09:09 neelimaj97

Please let me know if you find any workaround @00azzurri3

neelimaj97 avatar Sep 30 '21 09:09 neelimaj97

We try to keep the guides down to 15 minutes. If we start adding more detail, we quickly go past that 15 minutes. Try asking this question on Stack Overflow, where it will have much better visibility.

Buzzardo avatar Oct 19 '23 18:10 Buzzardo