代码之家  ›  专栏  ›  技术社区  ›  bibliophilsagar

zuul无法使用动态端口微服务路由

  •  0
  • bibliophilsagar  · 技术社区  · 6 年前

    我有一个动态端口的微服务,即, server.port=0 是的。 微服务正在尤里卡注册罚款,它正在运行。

    但是,当我试图通过Zuul网关访问它时,它无法处理我的Zuul网关中的以下日志。

    c.netflix.loadbalancer.BaseLoadBalancer  : Client: book instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=book,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
    c.n.l.DynamicServerListLoadBalancer      : Using serverListUpdater PollingServerListUpdater
    c.netflix.config.ChainedDynamicProperty  : Flipping property: book.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
    c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client book initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=book,current list of Servers=[192.168.60.1:0],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.60.1:0;    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@4dbc2e52
    

    但是,当我更改微服务的端口时( book )到非动态 server.port = 8081 ,一切运行良好,每次我也必须重新启动zuul应用程序。 我想当其中一个微服务更改端口时,情况不太好。

    让我分享 application.yml 两个文件的内容。

    微服务(书籍) 应用程序.yml

    spring:
      application:
        name: book
    
    server:
      port: 0 # I change it between 0 and 8081 (8081 works like a charm)
    
    eureka:
      client:
        service-url:
          defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
      instance:
        prefer-ip-address: true
    

    祖鲁 应用程序.yml

    server:
      port: 8080
    spring:
      application:
        name: gatekeeper
    
    zuul:
      routes:
        book: 
          serviceId: book
    
    #Added it so as to increase the timeout for the underlying hysterix of the zuul
    
    hystrix:
      command:
        default:
          execution:
            isolation:
              strategy: THREAD
              thread:
                timeoutInMilliseconds: 60000
    

    尤里卡服务器 应用程序.yml

    server:
      port: 8761
    
    eureka:
      client:
        register-with-eureka: false
        fetch-registry: false
    

    Sring云版本是动态的( ${spring-cloud.version} )带靴子 2.1.0.发布。

    0 回复  |  直到 6 年前