Spring Cloud Computing Service Search error: load balancing does not have an available server for the client

I played with a Spring cloud application consisting of a configuration server, discovery server (Eureka), and a Fign client with a ribbon (internally used function). I have 2 services, movie-service and daily-update-service . The goal is to update popular movies, news and weather daily in one place. The problem I am having is that the movie-service Feign client cannot find it from daily-update-service . It produces an error with the following:

 Caused by: java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: movie-service daily_update_service_1 | at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:59) ~[spring-cloud-netflix-core-1.1.0.M4.jar:1.1.0.M4] daily_update_service_1 | at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:95) ~[feign-core-8.12.1.jar:8.12.1] daily_update_service_1 | at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:74) ~[feign-core-8.12.1.jar:8.12.1] daily_update_service_1 | at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:54) ~[feign-hystrix-8.12.1.jar:8.12.1] daily_update_service_1 | at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294) ~[hystrix-core-1.4.21.jar:1.4.21] daily_update_service_1 | ... 21 common frames omitted daily_update_service_1 | Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: movie-service daily_update_service_1 | at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:468) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0] daily_update_service_1 | at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0] daily_update_service_1 | at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0] 

My debugging so far shows that DomainExtractingServerList is trying to view the VIP, which is movie-service and has no servers. Services are registered in Eureka and I can see them on the Eureka dashboard.

I'm not sure which code snippets are relevant, so I am posting a link to the Github project. Assuming you have Docker and Docker Compose installed, the easiest way to launch it and start it is to clone the project, and then follow the following instructions. These instructions are for Mac / Linux, adapt them to Windows if necessary. I will give specific code fragments if someone wants to see it here, and not look in the code.

  • cd daily-update-microservices .
  • Replace all incoming IP addresses of my docker. You can use this command: grep -rl '192.168.99.107' . | xargs perl -pi -e "s/192\.168\.99\.107/$(echo $DOCKER_HOST | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')/" grep -rl '192.168.99.107' . | xargs perl -pi -e "s/192\.168\.99\.107/$(echo $DOCKER_HOST | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')/"
  • Run ./gradlew clean buildDockerImage
  • Run docker-compose -f daily-update-service/docker-compose.yml up .
  • Once the services are available, do curl -v http://$(echo $DOCKER_HOST | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'):10000/dailyupdate/movies/popular
+3
source share
1 answer

In further research, I found that if eureka.client.fetchRegistry is false, the various shuffle methods in com.netflix.discovery.shared.Applications not called and therefore Applications.shuffleVirtualHostNameMap never populated. This map is used later for searching in the Applications.getInstancesByVirtualHostName method, which then fails.

I do not understand why the client will be forced to download the registry. They can choose a network trip every time or get a delta if necessary.

I discovered a problem for Github for this. Awaiting reply.

+5
source

Source: https://habr.com/ru/post/1013651/


All Articles