You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@GetMapping
public String getHealth() {
// TODO UP DOWN WARN
StringBuilder sb = new StringBuilder();
String dbStatus = dataSourceService.getHealth();
boolean addressServerHealthy = isAddressServerHealthy();
if (dbStatus.contains(HEALTH_UP) && addressServerHealthy && ServerMemberManager.isInIpList()) {
sb.append(HEALTH_UP);
} else if (dbStatus.contains(HEALTH_WARN) && addressServerHealthy && ServerMemberManager.isInIpList()) {
sb.append("WARN:");
sb.append("slave db (").append(dbStatus.split(":")[1]).append(") down. ");
} else {
sb.append("DOWN:");
if (dbStatus.contains(HEALTH_DOWN)) {
sb.append("master db (").append(dbStatus.split(":")[1]).append(") down. ");
}
if (!addressServerHealthy) {
sb.append("address server down. ");
}
if (!ServerMemberManager.isInIpList()) {
sb.append("server ip ").append(InetUtils.getSelfIP())
.append(" is not in the serverList of address server. ");
}
}
return sb.toString();
}
The text was updated successfully, but these errors were encountered:
Describe the bug
未配置使用address-server lookup时health接口返回响应'DOWN:address server down'
Expected behavior
未配置使用address-server lookup时health接口返回响应'UP'
Actually behavior
未配置使用address-server lookup时health接口返回响应'DOWN:address server down'
How to Reproduce
Steps to reproduce the behavior:
Desktop (please complete the following information):
Additional context
com.alibaba.nacos.config.server.controller.HealthController#getHealth 关于isAddressServerHealth的判断逻辑需要优化一下
非AddressServerMemberLookup时 addressServerHealth不是true,所以影响了health接口的响应内容
The text was updated successfully, but these errors were encountered: