@Override public void visit(State state, Environment env, Properties props) throws Exception { log.info("Starting all servers"); SetGoalState.main(new String[] {MasterGoalState.NORMAL.name()}); Process exec = Runtime.getRuntime() .exec(new String[] {System.getenv().get("ACCUMULO_HOME") + "/bin/start-all.sh"}); exec.waitFor(); while (true) { try { AccumuloServerContext context = new AccumuloServerContext( new ServerConfigurationFactory(HdfsZooInstance.getInstance())); Client client = MasterClient.getConnection(context); MasterMonitorInfo masterStats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds()); if (!masterStats.tServerInfo.isEmpty()) break; } catch (Exception ex) { sleepUninterruptibly(1, TimeUnit.SECONDS); } } }
private ArrayList<TabletServerStatus> getTabletServers() throws TException { ArrayList<TabletServerStatus> list = new ArrayList<>();// list of TServer info MasterClientService.Client client=null; // MasterClientService.Iface client=null; try { client = this.connection.getMasterClient(); //changed in accumulo-1.4 // mmi = client.getMasterStats(null, getAuthInfo()); TInfo tinfo = new TInfo(); MasterMonitorInfo mmi = client.getMasterStats(tinfo,this.connection.getCredentials() ); list.addAll(mmi.getTServerInfo()); } catch(D4mException e) { log.warn(e); } finally { ThriftUtil.returnClient(client); } return list; } private List<TabletStats> getTabletStatsList(List<TabletServerStatus> tserverNames, List<String> tableNames) throws D4mException {
client = MasterClient.getConnectionWithRetry(context); log.info("Fetching stats"); stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds()); } finally { if (client != null)
@Override public void visit(State state, Environment env, Properties props) throws Exception { log.info("shutting down"); SetGoalState.main(new String[] {MasterGoalState.CLEAN_STOP.name()}); while (!env.getConnector().instanceOperations().getTabletServers().isEmpty()) { sleepUninterruptibly(1, TimeUnit.SECONDS); } while (true) { try { AccumuloServerContext context = new AccumuloServerContext( new ServerConfigurationFactory(HdfsZooInstance.getInstance())); Client client = MasterClient.getConnection(context); client.getMasterStats(Tracer.traceInfo(), context.rpcCreds()); } catch (Exception e) { // assume this is due to server shutdown break; } sleepUninterruptibly(1, TimeUnit.SECONDS); } log.info("servers stopped"); sleepUninterruptibly(10, TimeUnit.SECONDS); }
private MasterMonitorInfo getStats(Connector c) throws Exception { Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD)); ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig()); Client client = null; try { client = MasterClient.getConnectionWithRetry(context); log.info("Fetching master stats"); return client.getMasterStats(Tracer.traceInfo(), context.rpcCreds()); } finally { if (client != null) { MasterClient.close(client); } } }