多个eureka 部署在同台机器 :lbState 中内容是错的,会造成混淆和误导。开发环境的zone3 变成了 zone1,zone2 ,这里只是日志打印错误,实际是在zone3上注册;
protected LoadBalancerStats lbStats;
//LoadBalancerStats 类中zoneState 信息保存在这个map中
volatile Map<String, ZoneStats> zoneStatsMap = new ConcurrentHashMap<String, ZoneStats>();
private ZoneStats getZoneStats(String zone) {
zone = zone.toLowerCase();
ZoneStats zs = zoneStatsMap.get(zone);
if (zs == null){
zoneStatsMap.put(zone, new ZoneStats(this.getName(), zone, this));
zs = zoneStatsMap.get(zone);
}
return zs;
}
@Override
public String toString() {
return "Zone stats: " + zoneStatsMap.toString()
+ "," + "Server stats: " + getSortedServerStats(getServerStats().values()).toString();
}
1.png
--
2.png
DynamicServerListLoadBalancer for client api-service initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=api-service,current list of Servers=[192.168.1.109:58823, 10.200.36.93:59354],Load balancer stats=Zone stats: {zone-1,zone-2=[Zone:zone-1,zone-2; Instance count:2; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
},Server stats: [[Server:192.168.1.109:58823; Zone:zone-1,zone-2; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Thu Jan 01 08:00:00 CST 1970; First connection made: Thu Jan 01 08:00:00 CST 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]
, [Server:10.200.36.93:59354; Zone:zone-1,zone-2; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Thu Jan 01 08:00:00 CST 1970; First connection made: Thu Jan 01 08:00:00 CST 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@7e798bab
网友评论