多個(gè)eureka 部署在同臺(tái)機(jī)器 :lbState 中內(nèi)容是錯(cuò)的粱哼,會(huì)造成混淆和誤導(dǎo)钦睡。開發(fā)環(huán)境的zone3 變成了 zone1,zone2 ,這里只是日志打印錯(cuò)誤憔鬼,實(shí)際是在zone3上注冊(cè)吉嚣;
protected LoadBalancerStats lbStats;
//LoadBalancerStats 類中zoneState 信息保存在這個(gè)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();
}
--
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