webapps.admin.cluster.jsp Maven / Gradle / Ivy
<%
/*
* 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 {
%>
No TajoMaster Rpc Server Rpc Client ResourceTracker
Catalog Active/Backup Status
<%
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";
%>
<%=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 fo for
%>
<%
} //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 {
%>
No QueryMaster Client Port Running Query Heap(free/total/max) Heartbeat Status
<%
int no = 1;
for(Worker queryMaster: liveQueryMasters) {
WorkerResource resource = queryMaster.getResource();
WorkerConnectionInfo connectionInfo = queryMaster.getConnectionInfo();
String queryMasterHttp = "http://" + connectionInfo.getHost()
+ ":" + connectionInfo.getHttpInfoPort() + "/index.jsp";
%>
<%=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 fo for
%>
<%
} //end of if
%>
<%
if(!deadQueryMasters.isEmpty()) {
%>
Dead QueryMaster
No QueryMaster
<%
int no = 1;
for(Worker queryMaster: deadQueryMasters) {
%>
<%=no++%>
<%=queryMaster.getConnectionInfo().getHost() + ":" + queryMaster.getConnectionInfo().getQueryMasterPort()%>
<%
} //end fo for
%>
<%
} //end of if
%>
Worker
Live:<%=liveWorkers.size()%>, Dead: <%=deadWorkersHtml%>
Live Workers
<%
if(liveWorkers.isEmpty()) {
out.write("No Live Workers\n");
} else {
%>
No Worker PullServer
Port Running Tasks Memory Resource
(used/total) Disk Resource
(used/total) Heap
(free/total/max) Heartbeat Status
<%
int no = 1;
for(Worker worker: liveWorkers) {
WorkerResource resource = worker.getResource();
WorkerConnectionInfo connectionInfo = worker.getConnectionInfo();
String workerHttp = "http://" + connectionInfo.getHost() + ":" + connectionInfo.getHttpInfoPort() + "/index.jsp";
%>
<%=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 fo for
%>
<%
} //end of if
%>
Dead Workers
<%
if(deadWorkers.isEmpty()) {
%>
No Dead Workers
<%
} else {
%>
No Worker
<%
int no = 1;
for(Worker worker: deadWorkers) {
WorkerResource resource = worker.getResource();
%>
<%=no++%>
<%=worker.getConnectionInfo().getHostAndPeerRpcPort()%>
<%
} //end fo for
%>
<%
} //end of if
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy