SpringCloud Gateway使用consul作为注册中心,consul在云服务器上,大家都在本地开发,于是我把consul的ribbon enabled: false
cloud:
consul:
ribbon:
enabled: false
gateway:
routes:
- id: db-management
uri: lb://db-management
predicates:
- Path=/management/**
db-management:
ribbon:
listOfServers: 192.168.0.107:8019
NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RoundRobinRule
现在使用网管转发,提示没有在线的服务:
No up servers available from load balancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=db-management,current list of Servers=[192.168.0.107:8019],Load balancer stats=Zone stats: {unknown=[Zone:unknown; Instance count:1; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
},Server stats: [[Server:192.168.0.107:8019; Zone:UNKNOWN; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Thu Jan 01 08:00:00 GMT+08:00 1970; First connection made: Thu Jan 01 08:00:00 GMT+08:00 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:com.netflix.loadbalancer.ConfigurationBasedServerList@40c4e7b8