Zuul没有路由到服务

时间:2019-04-26 16:24:50

标签: spring-cloud netflix-zuul

Zuul未路由到Eureka Server中注册的学生服务。 使用Greenwich.SR1

bootstrap.yml

server:
  port: 17005

# Eureka server details and its refresh time
eureka:
  instance:
    leaseRenewalIntervalInSeconds: 1
    leaseExpirationDurationInSeconds: 2
  client:
    registry-fetch-interval-seconds: 30
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
    healthcheck:
      enabled: true
    lease:
      duration: 5
    instance:
      lease-expiration-duration-in-seconds: 5
      lease-renewal-interval-in-seconds: 30

# Current service name to be used by the eureka server
spring:
  application:
    name: app-gateway

# Microservices routing configuration
zuul:
  routes:        
    students:
      path: /students/**
      serviceId: student-service
  host:
    socket-timeout-millis: 30000

hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 30000

我添加了PreFilter来记录来自UI的请求。每当来自UI的请求到达Zuul时-我会在日志中看到以下内容,但之后没有任何处理-未路由到学生服务。

Request Method : GET Request URL : http://localhost:17005/students/School2
2019-04-26 21:45:54.314  INFO 18196 --- [o-17005-exec-10] c.netflix.config.ChainedDynamicProperty  : Flipping property: student-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2019-04-26 21:45:54.387  INFO 18196 --- [o-17005-exec-10] c.n.u.concurrent.ShutdownEnabledTimer    : Shutdown hook installed for: NFLoadBalancer-PingTimer-student-service
2019-04-26 21:45:54.387  INFO 18196 --- [o-17005-exec-10] c.netflix.loadbalancer.BaseLoadBalancer  : Client: student-service instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=student-service,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2019-04-26 21:45:54.682  INFO 18196 --- [o-17005-exec-10] c.n.l.DynamicServerListLoadBalancer      : Using serverListUpdater PollingServerListUpdater
2019-04-26 21:45:54.720  INFO 18196 --- [o-17005-exec-10] c.netflix.config.ChainedDynamicProperty  : Flipping property: student-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2019-04-26 21:45:54.723  INFO 18196 --- [o-17005-exec-10] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client student-service initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=student-service,current list of Servers=[192.168.56.1:56567],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:192.168.56.1:56567;    Zone:defaultZone;   Total Requests:0;   Successive connection failure:0;    Total blackout seconds:0;   Last connection made:Thu Jan 01 05:30:00 IST 1970;  First connection made: Thu Jan 01 05:30:00 IST 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.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@42abe3b4
2019-04-26 21:45:55.742  INFO 18196 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty  : Flipping property: student-service.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647

微服务中没有异常跟踪。

对UI的响应: 类型=未找到,状态= 404

请帮助建立此路由。

0 个答案:

没有答案