[Bugfix]修复zk standalone状态不兼容问题

This commit is contained in:
ZQKC
2023-05-19 11:46:33 +08:00
committed by EricZeng
parent 2256e8bbdb
commit 7bfe787e39
3 changed files with 8 additions and 1 deletions

View File

@@ -102,6 +102,10 @@ public class HealthCheckZookeeperService extends AbstractHealthCheckService {
);
long value = infoList.stream().filter(elem -> ZKRoleEnum.LEADER.getRole().equals(elem.getRole())).count();
if (value == 0) {
// ZK 在单机模式下leader角色就是standalone
value = infoList.stream().filter(elem -> ZKRoleEnum.STANDALONE.getRole().equals(elem.getRole())).count();
}
checkResult.setPassed(value == 1 ? Constant.YES : Constant.NO);
return checkResult;