Load balancer does not have available server for client

前端 未结 8 1799
暗喜
暗喜 2020-12-08 07:36

I\'m trying to use Feign client. Below is my feing client:

import com.eprogrammerz.examples.domain.Movie;
import org.springframework.cloud.netflix.feign.Feig         


        
相关标签:
8条回答
  • 2020-12-08 08:08

    It seems like that ClientAppApplication doesn't know your eureka server's address. You could check you applation.yml

    eureka
      instance:
        hostname: cloud-feignorder-consume
      client:
        register-with-eureka: false #default true     
        fetch-registry: true #default true
    

    The last line you should check the property 'eureka.client.fetch-registry'.It should be true or not sign.Then your client could get the server list from eureka server.

    0 讨论(0)
  • 2020-12-08 08:15

    Without eureka, in client app, if you dont have application.yml rather application.properties file, then you can set the property as below before the client app restart :

    currency-exchange-service.ribbon.listOfServers : http://localhost:8000,http://localhost:8001

    0 讨论(0)
  • 2020-12-08 08:16

    I nearly wasted 2 hours to find the root cause. I mistakenly imported EnableEurekaClient in client application, which was the root cause for the issue. I finally resolved this issue by removing the import. To my surprise @EnableDiscoveryClient does not require the below dependency. But if you are using Eureka Naming server than this has to be used.

       <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
    
    0 讨论(0)
  • 2020-12-08 08:16

    The problem is that your service doesn't know the host of the requested service. If you are using Eureka and zuul, put this line on your zuul .properties or .yml file :

    eureka.client.fetch-registry=true

    0 讨论(0)
  • 2020-12-08 08:21

    After doing research, and with help of @Bloodysock, I found that I was missing registration of remote server in 'client-app' micro-service. The document is at Spring Cloud Netflix.

    I used Ribbon without Eureka with configuration in application.yml in 'client-app' micro-service as:

    movie-api:
      ribbon:
        listOfServers: http://localhost:8090
    
    0 讨论(0)
  • 2020-12-08 08:26

    The problem is that your service doesn't know the host of requested service. If you are using Eureka, put this line on your .properties or .yml file:

    eureka.client.fetchRegistry=true

    OR

    eureka:
        client:
            fetchRegistry: true
    

    It'll make your service talk with Eureka and discovers host of requested service.

    0 讨论(0)
提交回复
热议问题