Request to check using '.withHealthChecks()' on Custom loadbalancer configuration
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.
-
Download "complete" folder and run "say-hello" with port 8090 and run "user" with port 8888.
-
Try accessing to "user" : http://localhost:8888/hi
-
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')
-
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); }
-
Run "user" again and try accessing to "user".
-
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
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
Please let me know if you find any workaround @00azzurri3
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.