diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 7e9c4e57cb8a1dc5dd59961cdecb0ac2392fbc5e..26ffb5b2b5a2d371c458ba022ec32bfa2fc20f8f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -23,6 +23,7 @@ services: - "2181:2181" environment: ZOO_MY_ID: 1 + ZOO_4LW_COMMANDS_WHITELIST: srvr,ruok,wchs,cons db: image: postgres container_name: postgres diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZooKeeperState.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZooKeeperState.java index a33754397d971ffa5e23c29b4b9c51e50a8739ff..55bb3d336c87dd3091e863e9eb3ff5e872804438 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZooKeeperState.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZooKeeperState.java @@ -33,7 +33,7 @@ public class ZooKeeperState { private final String host; private final int port; - private int minLatency = -1, avgLatency = -1, maxLatency = -1; + private float minLatency = -1, avgLatency = -1, maxLatency = -1; private long received = -1; private long sent = -1; private int outStanding = -1; @@ -60,9 +60,9 @@ public class ZooKeeperState { String line = scannerForStat.nextLine(); if (line.startsWith("Latency min/avg/max:")) { String[] latencys = getStringValueFromLine(line).split("/"); - minLatency = Integer.parseInt(latencys[0]); - avgLatency = Integer.parseInt(latencys[1]); - maxLatency = Integer.parseInt(latencys[2]); + minLatency = Float.parseFloat(latencys[0]); + avgLatency = Float.parseFloat(latencys[1]); + maxLatency = Float.parseFloat(latencys[2]); } else if (line.startsWith("Received:")) { received = Long.parseLong(getStringValueFromLine(line)); } else if (line.startsWith("Sent:")) { @@ -165,15 +165,15 @@ public class ZooKeeperState { return port; } - public int getMinLatency() { + public float getMinLatency() { return minLatency; } - public int getAvgLatency() { + public float getAvgLatency() { return avgLatency; } - public int getMaxLatency() { + public float getMaxLatency() { return maxLatency; } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZookeeperMonitor.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZookeeperMonitor.java index f91d3bc68c39165da03c9d31f7610fc02906c7cd..7ba704916c6aaa7ebe5ff5950eb663989d437023 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZookeeperMonitor.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/ZookeeperMonitor.java @@ -88,9 +88,9 @@ public class ZookeeperMonitor extends AbstractZKClient { long sent = state.getSent(); long received = state.getReceived(); String mode = state.getMode(); - int minLatency = state.getMinLatency(); - int avgLatency = state.getAvgLatency(); - int maxLatency = state.getMaxLatency(); + float minLatency = state.getMinLatency(); + float avgLatency = state.getAvgLatency(); + float maxLatency = state.getMaxLatency(); int nodeCount = state.getNodeCount(); int status = ok ? 1 : 0; Date date = new Date(); diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ZookeeperRecord.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ZookeeperRecord.java index 6b86ac5c1173b22f642dcf1c4ac8ccef7b8ce937..7d45c66940ee119797b6c28db84418961b7cb33b 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ZookeeperRecord.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ZookeeperRecord.java @@ -56,17 +56,17 @@ public class ZookeeperRecord { /** * min Latency */ - private int minLatency; + private float minLatency; /** * avg Latency */ - private int avgLatency; + private float avgLatency; /** * max Latency */ - private int maxLatency; + private float maxLatency; /** * node count @@ -85,7 +85,7 @@ public class ZookeeperRecord { private int state; - public ZookeeperRecord(String hostname,int connections, int watches, long sent, long received, String mode, int minLatency, int avgLatency, int maxLatency, int nodeCount, int state,Date date) { + public ZookeeperRecord(String hostname,int connections, int watches, long sent, long received, String mode, float minLatency, float avgLatency, float maxLatency, int nodeCount, int state,Date date) { this.hostname = hostname; this.connections = connections; this.watches = watches; @@ -149,23 +149,23 @@ public class ZookeeperRecord { this.mode = mode; } - public int getMinLatency() { + public float getMinLatency() { return minLatency; } - public void setMinLatency(int minLatency) { + public void setMinLatency(float minLatency) { this.minLatency = minLatency; } - public int getAvgLatency() { + public float getAvgLatency() { return avgLatency; } - public void setAvgLatency(int avgLatency) { + public void setAvgLatency(float avgLatency) { this.avgLatency = avgLatency; } - public int getMaxLatency() { + public float getMaxLatency() { return maxLatency; }