2017-10-14 21 views
1

저는 Ribbon과 Netflix Eureka로 간단한 프로젝트를 만들었습니다. 유레카는 잘 작동하고 등록 된 모든 서비스를 볼 수 있습니다. 그러나 리본로드 밸런서는 서비스를 볼 수 없습니다. 사실 로그에 "서버의 현재 목록"에 서버가 있음을 표시하지만 발견 된 인스턴스가 없다는 예외가 있습니다. 나는 몇 가지 힌트 매우 감사하게 될 것입니다, 내가 로그 .... 그것을 알아 내기 위해 많은 시간 (그리고 일)를 보냈다 : (난 내 IP를 대체)리본과 유레카 - 인스턴스가 없습니다.

2017-10-14 18:13:18.118 INFO 6417 --- [nio-8080-exec-1] c.netflix.loadbalancer.BaseLoadBalancer : Client:reservationManagement instantiated a LoadBalancer:DynamicServerListLoadBalancer:{NFLoadBalancer:name=reservationManagement,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null 
2017-10-14 18:13:18.123 INFO 6417 --- [nio-8080-exec-1] c.n.l.DynamicServerListLoadBalancer  : Using serverListUpdater PollingServerListUpdater 
2017-10-14 18:13:18.165 INFO 6417 --- [nio-8080-exec-1] c.netflix.config.ChainedDynamicProperty : Flipping property: reservationManagement.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647 
2017-10-14 18:13:18.474 INFO 6417 --- [nio-8080-exec-1] c.n.l.DynamicServerListLoadBalancer  : DynamicServerListLoadBalancer for client reservationManagement initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=reservationManagement,current list of Servers=[<MY_IP>:8082],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone;  Instance count:1;  Active connections count: 0; Circuit breaker tripped count: 0;  Active connections per server: 0.0;] 
},Server stats: [[Server:<MY_IP>:8082; Zone:defaultZone;  Total Requests:0;  Successive connection failure:0;  Total blackout seconds:0;  Last connection made:Thu Jan 01 01:00:00 CET 1970;  First connection made: Thu Jan 01 01:00:00 CET 1970; Active Connections:0; total failure count in last (1000) msecs:0;  average resp time:0.0; 90 percentile resp time:0.0; 95 percentile resp time:0.0;  min resp time:0.0;  max resp time:0.0;  stddev resp time:0.0] 


2017-10-14 18:13:18.634 WARN 6417 --- [nio-8080-exec-1] com.netflix.loadbalancer.RoundRobinRule : No up servers available from load balancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=reservationManagement,current list of Servers=[<MY_IP>:8082],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone;  Instance count:1;  Active connections count: 0; Circuit breaker tripped count: 0;  Active connections per server: 0.0;] 
},Server stats: [[Server:<MY_IP>:8082; Zone:defaultZone;  Total Requests:0;  Successive connection failure:0;  Total blackout seconds:0;  Last connection made:Thu Jan 01 01:00:00 CET 1970;  First connection made: Thu Jan 01 01:00:00 CET 1970; Active Connections:0; total failure count in last (1000) msecs:0;  average resp time:0.0; 90 percentile resp time:0.0; 95 percentile resp time:0.0;  min resp time:0.0;  max resp time:0.0;  stddev resp time:0.0] 
]}ServerList:org.springf[email protected]1fd42bb7 
2017-10-14 18:13:18.655 ERROR 6417 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: No instances available for reservationManagement] with root cause 

java.lang.IllegalStateException: No instances available for reservationManagement 

CODE :

package project.controller; 

import org.springframework.beans.factory.annotation.Autowired; 
import org.springframework.cloud.client.loadbalancer.LoadBalanced; 
import org.springframework.cloud.netflix.ribbon.RibbonClient; 
import org.springframework.context.annotation.Bean; 
import org.springframework.core.env.Environment; 
import org.springframework.web.bind.annotation.RequestMapping; 
import org.springframework.web.bind.annotation.RequestParam; 
import org.springframework.web.bind.annotation.RestController; 
import org.springframework.web.client.RestTemplate; 
import configuration.ReservationConfiguration; 

@RestController 
@RibbonClient(name = "reservationManagement", configuration = ReservationConfiguration.class) 
public class MyController { 

    @Autowired 
    private Environment env; 

    @Bean 
    @LoadBalanced 
    RestTemplate restTemplate(){ 
     return new RestTemplate(); 
    } 

    @Autowired 
    RestTemplate restTemplate; 


    @RequestMapping(value = "/info") 
    public String home() { 
     final String reservationResponse = this.restTemplate.getForObject("http://reservationManagement/info",String.class); 
     final String flightResponse = env.getProperty("spring.application.name") + " port: " + env.getProperty("server.port"); 
     return flightResponse + " from " + reservationResponse; 
    } 
} 


package configuration; 

import org.springframework.beans.factory.annotation.Autowired; 
import org.springframework.context.annotation.Bean; 

import com.netflix.client.config.IClientConfig; 
import com.netflix.loadbalancer.IPing; 
import com.netflix.loadbalancer.IRule; 
import com.netflix.loadbalancer.PingUrl; 
import com.netflix.loadbalancer.AvailabilityFilteringRule; 

public class ReservationConfiguration { 

    @Autowired 
    IClientConfig ribbonClientConfig; 

    @Bean 
    /*The default IPing is a NoOpPing (which doesn’t actually ping server instances, instead always reporting that they’re stable), */ 
    public IPing ribbonPing(IClientConfig config) { 
    return new PingUrl(); 
    } 

    @Bean 
    public IRule ribbonRule(IClientConfig config) { 
    return new AvailabilityFilteringRule(); 
    } 

} 

application.yml

server: 
    port: 8080 
eureka.client.fetchRegistry: true 
reservationManagement: 
    ribbon: 
    eureka: 
     enabled: true 
    ServerListRefreshInterval: 15000 

유레카 서버는 기본 포트에 있습니다. 내가 무엇이 누락 되었습니까?

편집 : 유레카이 서비스를보고 : screen

답변

0

이 응용 프로그램 reservationManagement 유레카 레지스트리에 등록되어 있는지 확인합니다. 또한 사용하십시오 https://reservationManagement/info

+0

예, 나는 유레카 페이지의 화면으로 게시물을 업데이 트했습니다. 왜 https인가? –

+0

Https도 작동하지 않습니다 –

+0

이것에 어떤 뉴스? – seven