@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 static void stopTabletServer(final ClientContext context, List<String> servers, final boolean force) throws AccumuloException, AccumuloSecurityException { if (context.getMasterLocations().size() == 0) { log.info("No masters running. Not attempting safe unload of tserver."); return; } final String zTServerRoot = getTServersZkPath(context); final ZooCache zc = context.getZooCache(); for (String server : servers) { for (int port : context.getConfiguration().getPort(Property.TSERV_CLIENTPORT)) { HostAndPort address = AddressUtil.parseAddress(server, port); final String finalServer = qualifyWithZooKeeperSessionId(zTServerRoot, zc, address.toString()); log.info("Stopping server {}", finalServer); MasterClient.executeVoid(context, client -> client.shutdownTabletServer(Tracer.traceInfo(), context.rpcCreds(), finalServer, force)); } } }
public org.apache.accumulo.core.securityImpl.thrift.TDelegationToken getResult() throws org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException, org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException, org.apache.thrift.TException { if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new java.lang.IllegalStateException("Method call not finished!"); } org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); return (new Client(prot)).recv_getDelegationToken(); } }
client = MasterClient.getConnectionWithRetry(context); log.info("Fetching stats"); stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds()); } finally { if (client != null)
/** * Get the active tabletservers as seen by the master. * * @return The active tabletservers, null if they can't be computed. */ protected List<String> getActiveTservers(TInfo tinfo) { MasterClientService.Client client = null; List<String> tservers = null; try { client = getMasterConnection(); // Could do this through InstanceOperations, but that would set a bunch of new Watchers via ZK // on every tserver // node. The master is already tracking all of this info, so hopefully this is less overall // work. if (null != client) { tservers = client.getActiveTservers(tinfo, context.rpcCreds()); } } catch (TException e) { // If we can't fetch the tabletservers, we can't fetch any active WALs log.warn("Failed to fetch active tabletservers from the master", e); return null; } finally { ThriftUtil.returnClient(client); } return tservers; }
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 {
@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); }
public long recv_initiateFlush() throws org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException, org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException, org.apache.thrift.TException { initiateFlush_result result = new initiateFlush_result(); receiveBase(result, "initiateFlush"); if (result.isSetSuccess()) { return result.success; } if (result.sec != null) { throw result.sec; } if (result.tope != null) { throw result.tope; } throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "initiateFlush failed: unknown result"); }
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); } } }
public Client getClient(org.apache.thrift.protocol.TProtocol prot) { return new Client(prot); } public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { return new Client(iprot, oprot); } }
public void recv_shutdown() throws org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException, org.apache.thrift.TException { shutdown_result result = new shutdown_result(); receiveBase(result, "shutdown"); if (result.sec != null) { throw result.sec; } return; }
public void recv_removeNamespaceProperty() throws org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException, org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException, org.apache.thrift.TException { removeNamespaceProperty_result result = new removeNamespaceProperty_result(); receiveBase(result, "removeNamespaceProperty"); if (result.sec != null) { throw result.sec; } if (result.tope != null) { throw result.tope; } return; }
public void recv_removeTableProperty() throws org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException, org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException, org.apache.thrift.TException { removeTableProperty_result result = new removeTableProperty_result(); receiveBase(result, "removeTableProperty"); if (result.sec != null) { throw result.sec; } if (result.tope != null) { throw result.tope; } return; }
public void recv_waitForFlush() throws org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException, org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException, org.apache.thrift.TException { waitForFlush_result result = new waitForFlush_result(); receiveBase(result, "waitForFlush"); if (result.sec != null) { throw result.sec; } if (result.tope != null) { throw result.tope; } return; }
public void getResult() throws org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException, org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException, org.apache.thrift.TException { if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); (new Client(prot)).recv_removeTableProperty(); } }
public boolean drainReplicationTable(org.apache.accumulo.core.trace.thrift.TInfo tfino, org.apache.accumulo.core.security.thrift.TCredentials credentials, String tableName, Set<String> logsToWatch) throws org.apache.thrift.TException { send_drainReplicationTable(tfino, credentials, tableName, logsToWatch); return recv_drainReplicationTable(); }
@Override public void execute(MasterClientService.Client client) throws Exception { client.shutdownTabletServer(Tracer.traceInfo(), context.rpcCreds(), finalServer, force); } });
@Override public List<String> execute(MasterClientService.Client client) throws Exception { return client.getActiveTservers(Tracer.traceInfo(), context.rpcCreds()); } });
@Override public void execute(MasterClientService.Client client) throws Exception { client.shutdownTabletServer(Tracer.traceInfo(), creds, finalServer, force); } });