diff --git a/api/src/main/java/com/alibaba/nacos/api/config/ConfigService.java b/api/src/main/java/com/alibaba/nacos/api/config/ConfigService.java index 9a96a528b..0b759772f 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/ConfigService.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/ConfigService.java @@ -99,5 +99,12 @@ public interface ConfigService { * listener */ public void removeListener(String dataId, String group, Listener listener); + + /** + * server health info + * + * @return whether health + */ + public String getServerStatus(); } diff --git a/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java b/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java index 3b4953e10..2e3d6c3a4 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/NacosConfigService.java @@ -264,4 +264,13 @@ public class NacosConfigService implements ConfigService { } + @Override + public String getServerStatus() { + if (worker.isHealthServer()) { + return "UP"; + } else { + return "DOWN"; + } + } + }