use of org.apache.accumulo.core.manager.thrift.DeadServer in project accumulo by apache.
the class GetManagerStats method main.
public static void main(String[] args) throws Exception {
ManagerClientService.Iface client = null;
ManagerMonitorInfo stats = null;
var context = new ServerContext(SiteConfiguration.auto());
while (true) {
try {
client = ManagerClient.getConnectionWithRetry(context);
stats = client.getManagerStats(TraceUtil.traceInfo(), context.rpcCreds());
break;
} catch (ThriftNotActiveServiceException e) {
// Let it loop, fetching a new location
sleepUninterruptibly(100, MILLISECONDS);
} finally {
if (client != null) {
ManagerClient.close(client, context);
}
}
}
out(0, "State: " + stats.state.name());
out(0, "Goal State: " + stats.goalState.name());
if (stats.serversShuttingDown != null && !stats.serversShuttingDown.isEmpty()) {
out(0, "Servers to shutdown");
for (String server : stats.serversShuttingDown) {
out(1, "%s", server);
}
}
out(0, "Unassigned tablets: %d", stats.unassignedTablets);
if (stats.badTServers != null && !stats.badTServers.isEmpty()) {
out(0, "Bad servers");
for (Entry<String, Byte> entry : stats.badTServers.entrySet()) {
out(1, "%s: %d", entry.getKey(), (int) entry.getValue());
}
}
out(0, "Dead tablet servers count: %s", stats.deadTabletServers.size());
for (DeadServer dead : stats.deadTabletServers) {
out(1, "Dead tablet server: %s", dead.server);
out(2, "Last report: %s", new SimpleDateFormat().format(new Date(dead.lastStatus)));
out(2, "Cause: %s", dead.status);
}
out(0, "Bulk imports: %s", stats.bulkImports.size());
for (BulkImportStatus bulk : stats.bulkImports) {
out(1, "Import directory: %s", bulk.filename);
out(2, "Bulk state %s", bulk.state);
out(2, "Bulk start %s", bulk.startTime);
}
if (stats.tableMap != null && !stats.tableMap.isEmpty()) {
out(0, "Tables");
for (Entry<String, TableInfo> entry : stats.tableMap.entrySet()) {
TableInfo v = entry.getValue();
out(1, "%s", entry.getKey());
out(2, "Records: %d", v.recs);
out(2, "Records in Memory: %d", v.recsInMemory);
out(2, "Tablets: %d", v.tablets);
out(2, "Online Tablets: %d", v.onlineTablets);
out(2, "Ingest Rate: %.2f", v.ingestRate);
out(2, "Query Rate: %.2f", v.queryRate);
}
}
if (stats.tServerInfo != null && !stats.tServerInfo.isEmpty()) {
out(0, "Tablet Servers");
long now = System.currentTimeMillis();
for (TabletServerStatus server : stats.tServerInfo) {
TableInfo summary = TableInfoUtil.summarizeTableStats(server);
out(1, "Name: %s", server.name);
out(2, "Ingest: %.2f", summary.ingestRate);
out(2, "Last Contact: %s", server.lastContact);
out(2, "OS Load Average: %.2f", server.osLoad);
out(2, "Queries: %.2f", summary.queryRate);
out(2, "Time Difference: %.1f", ((now - server.lastContact) / 1000.));
out(2, "Total Records: %d", summary.recs);
out(2, "Lookups: %d", server.lookups);
if (server.holdTime > 0) {
out(2, "Hold Time: %d", server.holdTime);
}
if (server.tableMap != null && !server.tableMap.isEmpty()) {
out(2, "Tables");
for (Entry<String, TableInfo> status : server.tableMap.entrySet()) {
TableInfo info = status.getValue();
out(3, "Table: %s", status.getKey());
out(4, "Tablets: %d", info.onlineTablets);
out(4, "Records: %d", info.recs);
out(4, "Records in Memory: %d", info.recsInMemory);
out(4, "Ingest: %.2f", info.ingestRate);
out(4, "Queries: %.2f", info.queryRate);
out(4, "Major Compacting: %d", info.majors == null ? 0 : info.majors.running);
out(4, "Queued for Major Compaction: %d", info.majors == null ? 0 : info.majors.queued);
out(4, "Minor Compacting: %d", info.minors == null ? 0 : info.minors.running);
out(4, "Queued for Minor Compaction: %d", info.minors == null ? 0 : info.minors.queued);
}
}
out(2, "Recoveries: %d", server.logSorts.size());
for (RecoveryStatus sort : server.logSorts) {
out(3, "File: %s", sort.name);
out(3, "Progress: %.2f%%", sort.progress * 100);
out(3, "Time running: %s", sort.runtime / 1000.);
}
out(3, "Bulk imports: %s", stats.bulkImports.size());
for (BulkImportStatus bulk : stats.bulkImports) {
out(4, "Import file: %s", bulk.filename);
out(5, "Bulk state %s", bulk.state);
out(5, "Bulk start %s", bulk.startTime);
}
}
}
}
use of org.apache.accumulo.core.manager.thrift.DeadServer in project accumulo by apache.
the class ManagerResource method getDeadLoggers.
/**
* Generates a dead logger list as a JSON object
*
* @return dead logger list
*/
public static DeadLoggerList getDeadLoggers(Monitor monitor) {
ManagerMonitorInfo mmi = monitor.getMmi();
if (mmi == null) {
return new DeadLoggerList();
}
DeadLoggerList deadLoggers = new DeadLoggerList();
// Add new dead loggers to the list
for (DeadServer dead : mmi.deadTabletServers) {
deadLoggers.addDeadLogger(new DeadLoggerInformation(dead.server, dead.lastStatus, dead.status));
}
return deadLoggers;
}
use of org.apache.accumulo.core.manager.thrift.DeadServer in project accumulo by apache.
the class ManagerResource method getTables.
public static ManagerInformation getTables(Monitor monitor) {
ManagerInformation managerInformation;
ManagerMonitorInfo mmi = monitor.getMmi();
if (mmi != null) {
GCStatus gcStatusObj = monitor.getGcStatus();
String gcStatus = "Waiting";
String label = "";
if (gcStatusObj != null) {
long start = 0;
if (gcStatusObj.current.started != 0 || gcStatusObj.currentLog.started != 0) {
start = Math.max(gcStatusObj.current.started, gcStatusObj.currentLog.started);
label = "Running";
} else if (gcStatusObj.lastLog.finished != 0) {
start = gcStatusObj.lastLog.finished;
}
if (start != 0) {
gcStatus = String.valueOf(start);
}
} else {
gcStatus = "Down";
}
List<String> tservers = new ArrayList<>();
for (TabletServerStatus up : mmi.tServerInfo) {
tservers.add(up.name);
}
for (DeadServer down : mmi.deadTabletServers) {
tservers.add(down.server);
}
List<String> managers = monitor.getContext().getManagerLocations();
String manager = managers.isEmpty() ? "Down" : AddressUtil.parseAddress(managers.get(0), false).getHost();
int onlineTabletServers = mmi.tServerInfo.size();
int totalTabletServers = tservers.size();
int tablets = monitor.getTotalTabletCount();
int unassignedTablets = mmi.unassignedTablets;
long entries = monitor.getTotalEntries();
double ingest = monitor.getTotalIngestRate();
double entriesRead = monitor.getTotalScanRate();
double entriesReturned = monitor.getTotalQueryRate();
long holdTime = monitor.getTotalHoldTime();
double osLoad = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage();
int tables = monitor.getTotalTables();
int deadTabletServers = mmi.deadTabletServers.size();
long lookups = monitor.getTotalLookups();
long uptime = System.currentTimeMillis() - monitor.getStartTime();
managerInformation = new ManagerInformation(manager, onlineTabletServers, totalTabletServers, gcStatus, tablets, unassignedTablets, entries, ingest, entriesRead, entriesReturned, holdTime, osLoad, tables, deadTabletServers, lookups, uptime, label, getGoalState(monitor), getState(monitor), getNumBadTservers(monitor), getServersShuttingDown(monitor), getDeadTservers(monitor), getDeadLoggers(monitor));
} else {
managerInformation = new ManagerInformation();
}
return managerInformation;
}
use of org.apache.accumulo.core.manager.thrift.DeadServer in project accumulo by apache.
the class ManagerResource method getDeadTservers.
/**
* Generates a dead server list as a JSON object
*
* @return dead server list
*/
public static DeadServerList getDeadTservers(Monitor monitor) {
ManagerMonitorInfo mmi = monitor.getMmi();
if (mmi == null) {
return new DeadServerList();
}
DeadServerList deadServers = new DeadServerList();
// Add new dead servers to the list
for (DeadServer dead : mmi.deadTabletServers) {
deadServers.addDeadServer(new DeadServerInformation(dead.server, dead.lastStatus, dead.status));
}
return deadServers;
}
use of org.apache.accumulo.core.manager.thrift.DeadServer in project accumulo by apache.
the class DeadServerList method getList.
public List<DeadServer> getList() {
List<DeadServer> result = new ArrayList<>();
try {
List<String> children = zoo.getChildren(path);
if (children != null) {
for (String child : children) {
Stat stat = new Stat();
byte[] data;
try {
data = zoo.getData(path + "/" + child, stat);
} catch (NoNodeException nne) {
// in the dead server list.
continue;
}
DeadServer server = new DeadServer(child, stat.getMtime(), new String(data, UTF_8));
result.add(server);
}
}
} catch (Exception ex) {
log.error("{}", ex.getMessage(), ex);
}
return result;
}
Aggregations