Browse Source

we should insert alert DB once , and trigger this type of alert 3 times

pull/2/head
Technoboy- 5 years ago
parent
commit
cfd3266ca2
  1. 6
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
  2. 4
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
  3. 6
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java

6
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java

@ -152,10 +152,8 @@ public class MasterServer implements IStoppable {
@Override @Override
public void run() { public void run() {
if (zkMasterClient.getActiveMasterNum() <= 1) { if (zkMasterClient.getActiveMasterNum() <= 1) {
for (int i = 0; i < Constants.DOLPHINSCHEDULER_WARN_TIMES_FAILOVER; i++) { zkMasterClient.getAlertDao().sendServerStopedAlert(
zkMasterClient.getAlertDao().sendServerStopedAlert( 1, OSUtils.getHost(), "Master-Server");
1, OSUtils.getHost(), "Master-Server");
}
} }
stop("shutdownhook"); stop("shutdownhook");
} }

4
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java

@ -177,9 +177,7 @@ public class WorkerServer implements IStoppable {
public void run() { public void run() {
// worker server exit alert // worker server exit alert
if (zkWorkerClient.getActiveMasterNum() <= 1) { if (zkWorkerClient.getActiveMasterNum() <= 1) {
for (int i = 0; i < Constants.DOLPHINSCHEDULER_WARN_TIMES_FAILOVER; i++) { alertDao.sendServerStopedAlert(1, OSUtils.getHost(), "Worker-Server");
alertDao.sendServerStopedAlert(1, OSUtils.getHost(), "Worker-Server");
}
} }
stop("shutdownhook"); stop("shutdownhook");
} }

6
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java

@ -247,10 +247,8 @@ public class ZKMasterClient extends AbstractZKClient {
*/ */
private void alertServerDown(String serverHost, ZKNodeType zkNodeType) { private void alertServerDown(String serverHost, ZKNodeType zkNodeType) {
String serverType = zkNodeType.toString(); String serverType = zkNodeType.toString();
for (int i = 0; i < Constants.DOLPHINSCHEDULER_WARN_TIMES_FAILOVER; i++) { alertDao.sendServerStopedAlert(1, serverHost, serverType);
alertDao.sendServerStopedAlert(1, serverHost, serverType);
}
} }
/** /**

Loading…
Cancel
Save