All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webapps.admin.cluster.jsp Maven / Gradle / Ivy

There is a newer version: 0.11.3
Show newest version
<%
  /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
  * regarding copyright ownership. The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License. You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ page import="org.apache.tajo.master.TajoMaster" %>
<%@ page import="org.apache.tajo.master.cluster.WorkerConnectionInfo" %>
<%@ page import="org.apache.tajo.service.ServiceTracker" %>
<%@ page import="org.apache.tajo.service.TajoMasterInfo" %>
<%@ page import="org.apache.tajo.master.rm.Worker" %>
<%@ page import="org.apache.tajo.master.rm.WorkerResource" %>
<%@ page import="org.apache.tajo.master.rm.WorkerState" %>
<%@ page import="org.apache.tajo.util.JSPUtil" %>
<%@ page import="org.apache.tajo.util.TUtil" %>
<%@ page import="org.apache.tajo.webapp.StaticHttpServer" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.tajo.service.ServiceTracker" %>
<%@ page import="java.net.InetSocketAddress" %>

<%
  TajoMaster master = (TajoMaster) StaticHttpServer.getInstance().getAttribute("tajo.info.server.object");

  String[] masterName = master.getMasterName().split(":");
  InetSocketAddress socketAddress = new InetSocketAddress(masterName[0], Integer.parseInt(masterName[1]));
  String masterLabel = socketAddress.getAddress().getHostName()+ ":" + socketAddress.getPort();

  Map workers = master.getContext().getResourceManager().getWorkers();
  List wokerKeys = new ArrayList(workers.keySet());
  Collections.sort(wokerKeys);

  int runningQueryMasterTasks = 0;

  Set liveWorkers = new TreeSet();
  Set deadWorkers = new TreeSet();
  Set decommissionWorkers = new TreeSet();

  Set liveQueryMasters = new TreeSet();
  Set deadQueryMasters = new TreeSet();

  for(Worker eachWorker: workers.values()) {
    if(eachWorker.getResource().isQueryMasterMode()) {
      liveQueryMasters.add(eachWorker);
      runningQueryMasterTasks += eachWorker.getResource().getNumQueryMasterTasks();
    }

    if(eachWorker.getResource().isTaskRunnerMode()) {
      liveWorkers.add(eachWorker);
    }
  }

  for (Worker inactiveWorker : master.getContext().getResourceManager().getInactiveWorkers().values()) {
    WorkerState state = inactiveWorker.getState();

    if (state == WorkerState.LOST) {
      if (inactiveWorker.getResource().isQueryMasterMode()) {
        deadQueryMasters.add(inactiveWorker);
      }
      if (inactiveWorker.getResource().isTaskRunnerMode()) {
        deadWorkers.add(inactiveWorker);
      }
    } else if (state == WorkerState.DECOMMISSIONED) {
      decommissionWorkers.add(inactiveWorker);
    }
  }

  String deadWorkersHtml = deadWorkers.isEmpty() ? "0": "" + deadWorkers.size() + "";
  String deadQueryMastersHtml = deadQueryMasters.isEmpty() ? "0": "" + deadQueryMasters.size() + "";

  ServiceTracker haService = master.getContext().getHAService();
  List masters = TUtil.newList();

  String activeLabel = "";
  if (haService != null) {
    if (haService.isActiveMaster()) {
      activeLabel = "(active)";
    } else {
      activeLabel = "(backup)";
    }

    masters.addAll(haService.getMasters());
  }

  int numLiveMasters = 0;
  int numDeadMasters = 0;

  for(TajoMasterInfo eachMaster : masters) {
    if (eachMaster.isAvailable()) {
      numLiveMasters++;
    } else {
      numDeadMasters++;
    }
  }
  String deadMasterHtml = numDeadMasters == 0 ? "0": "" + numDeadMasters +"";

%>




  
  
  Tajo


<%@ include file="header.jsp"%>

Tajo Master: <%=masterLabel%> <%=activeLabel%>

Live:<%=numLiveMasters%>, Dead: <%=deadMasterHtml%>, Total: <%=masters.size()%>
<% if (masters != null) { if(numLiveMasters == 0) { out.write("No TajoMasters\n"); } else { %>

<% int no = 1; for(TajoMasterInfo eachMaster : masters) { String tajoMasterHttp = "http://" + eachMaster.getWebServerAddress().getHostName() + ":" + eachMaster.getWebServerAddress().getPort() + "/index.jsp"; String isActive = eachMaster.isActive() == true ? "ACTIVE" : "BACKUP"; String isAvailable = eachMaster.isAvailable() == true ? "RUNNING" : "FAILED"; %> <% } //end fo for %>
NoTajoMasterRpc ServerRpc ClientResourceTracker CatalogActive/BackupStatus
<%=no++%> <%=eachMaster.getWebServerAddress().getHostName() + ":" + eachMaster.getWebServerAddress().getPort()%> <%=eachMaster.getTajoMasterAddress().getHostName() + ":" + eachMaster.getTajoMasterAddress().getPort()%> <%=eachMaster.getTajoClientAddress().getHostName() + ":" + eachMaster.getTajoClientAddress().getPort()%> <%=eachMaster.getWorkerResourceTrackerAddr().getHostName() + ":" + eachMaster.getWorkerResourceTrackerAddr().getPort()%> <%=eachMaster.getCatalogAddress().getHostName() + ":" + eachMaster.getCatalogAddress().getPort()%> <%=isActive%> <%=isAvailable%>
<% } //end of if %>

<% } //end of if %>


Query Master

Live:<%=liveQueryMasters.size()%>, Dead: <%=deadQueryMastersHtml%>, QueryMaster Tasks: <%=runningQueryMasterTasks%>

Live QueryMasters

<% if(liveQueryMasters.isEmpty()) { out.write("No Live QueryMasters\n"); } else { %> <% int no = 1; for(Worker queryMaster: liveQueryMasters) { WorkerResource resource = queryMaster.getResource(); WorkerConnectionInfo connectionInfo = queryMaster.getConnectionInfo(); String queryMasterHttp = "http://" + connectionInfo.getHost() + ":" + connectionInfo.getHttpInfoPort() + "/index.jsp"; %> <% } //end fo for %>
NoQueryMasterClient PortRunning QueryHeap(free/total/max)HeartbeatStatus
<%=no++%> <%=connectionInfo.getHost() + ":" + connectionInfo.getQueryMasterPort()%> <%=connectionInfo.getClientPort()%> <%=resource.getNumQueryMasterTasks()%> <%=resource.getFreeHeap()/1024/1024%>/<%=resource.getTotalHeap()/1024/1024%>/<%=resource.getMaxHeap()/1024/1024%> MB <%=JSPUtil.getElapsedTime(queryMaster.getLastHeartbeatTime(), System.currentTimeMillis())%> <%=queryMaster.getState()%>
<% } //end of if %>

<% if(!deadQueryMasters.isEmpty()) { %>


Dead QueryMaster

<% int no = 1; for(Worker queryMaster: deadQueryMasters) { %> <% } //end fo for %>
NoQueryMaster
<%=no++%> <%=queryMaster.getConnectionInfo().getHost() + ":" + queryMaster.getConnectionInfo().getQueryMasterPort()%>

<% } //end of if %>


Worker

Live:<%=liveWorkers.size()%>, Dead: <%=deadWorkersHtml%>

Live Workers

<% if(liveWorkers.isEmpty()) { out.write("No Live Workers\n"); } else { %> <% int no = 1; for(Worker worker: liveWorkers) { WorkerResource resource = worker.getResource(); WorkerConnectionInfo connectionInfo = worker.getConnectionInfo(); String workerHttp = "http://" + connectionInfo.getHost() + ":" + connectionInfo.getHttpInfoPort() + "/index.jsp"; %> <% } //end fo for %>
NoWorkerPullServer
Port
Running TasksMemory Resource
(used/total)
Disk Resource
(used/total)
Heap
(free/total/max)
HeartbeatStatus
<%=no++%> <%=connectionInfo.getHostAndPeerRpcPort()%> <%=connectionInfo.getPullServerPort()%> <%=resource.getNumRunningTasks()%> <%=resource.getUsedMemoryMB()%>/<%=resource.getMemoryMB()%> <%=resource.getUsedDiskSlots()%>/<%=resource.getDiskSlots()%> <%=resource.getFreeHeap()/1024/1024%>/<%=resource.getTotalHeap()/1024/1024%>/<%=resource.getMaxHeap()/1024/1024%> MB <%=JSPUtil.getElapsedTime(worker.getLastHeartbeatTime(), System.currentTimeMillis())%> <%=worker.getState()%>
<% } //end of if %>


Dead Workers

<% if(deadWorkers.isEmpty()) { %> No Dead Workers <% } else { %> <% int no = 1; for(Worker worker: deadWorkers) { WorkerResource resource = worker.getResource(); %> <% } //end fo for %>
NoWorker
<%=no++%> <%=worker.getConnectionInfo().getHostAndPeerRpcPort()%>
<% } //end of if %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy