/** * @see org.apache.hadoop.hbase.master.HMasterCommandLine */ public static void main(String [] args) { LOG.info("STARTING service " + HMaster.class.getSimpleName()); VersionInfo.logVersion(); new HMasterCommandLine(HMaster.class).doMain(args); }
private void waitOnMasterThreads(LocalHBaseCluster cluster) throws InterruptedException{ List<JVMClusterUtil.MasterThread> masters = cluster.getMasters(); List<JVMClusterUtil.RegionServerThread> regionservers = cluster.getRegionServers(); if (masters != null) { for (JVMClusterUtil.MasterThread t : masters) { t.join(); if(t.getMaster().isAborted()) { closeAllRegionServerThreads(regionservers); throw new RuntimeException("HMaster Aborted"); } } } }
} catch (ParseException e) { LOG.error("Could not parse: ", e); usage(null); return 1; getConf().setInt("hbase.regions.server.count.min", Integer.parseInt(val)); LOG.debug("minRegionServers set to " + val); getConf().setInt("hbase.regions.server.count.min", Integer.parseInt(val)); LOG.debug("minServers set to " + val); getConf().setBoolean(HConstants.MASTER_TYPE_BACKUP, true); getConf().setInt("hbase.regionservers", Integer.parseInt(val)); LOG.debug("localRegionServers set to " + val); getConf().setInt("hbase.masters", Integer.parseInt(val)); LOG.debug("masters set to " + val); List<String> remainingArgs = cmd.getArgList(); if (remainingArgs.size() != 1) { usage(null); return 1; return startMaster(); } else if ("stop".equals(command)) { return stopMaster(); } else if ("clear".equals(command)) {
@Test public void testRun() throws Exception { HMasterCommandLine masterCommandLine = new HMasterCommandLine(HMaster.class); masterCommandLine.setConf(TESTING_UTIL.getConfiguration()); assertEquals(0, masterCommandLine.run(new String [] {"clear"})); } }
private int startMaster() { Configuration conf = getConf(); TraceUtil.initTracer(conf); ((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster); cluster.startup(); waitOnMasterThreads(cluster); } else { logProcessInfo(getConf()); HMaster master = HMaster.constructMaster(masterClass, conf); if (master.isStopped()) {
private int startMaster() { Configuration conf = getConf(); try { ((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster); cluster.startup(); waitOnMasterThreads(cluster); } else { HMaster master = HMaster.constructMaster(masterClass, conf);
@SuppressWarnings("resource") private int stopMaster() { Configuration conf = getConf(); // Don't try more than once conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 0); try (Connection connection = ConnectionFactory.createConnection(conf)) { try (Admin admin = connection.getAdmin()) { admin.shutdown(); } catch (Throwable t) { LOG.error("Failed to stop master", t); return 1; } } catch (MasterNotRunningException e) { LOG.error("Master not running"); return 1; } catch (ZooKeeperConnectionException e) { LOG.error("ZooKeeper not available"); return 1; } catch (IOException e) { LOG.error("Got IOException: " +e.getMessage(), e); return 1; } return 0; }
private int startMaster() { Configuration conf = getConf(); try { ((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster); cluster.startup(); waitOnMasterThreads(cluster); } else { logProcessInfo(getConf()); CoordinatedStateManager csm = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
@Test public void testRun() throws Exception { HMasterCommandLine masterCommandLine = new HMasterCommandLine(HMaster.class); masterCommandLine.setConf(TESTING_UTIL.getConfiguration()); assertEquals(0, masterCommandLine.run(new String [] {"clear"})); } }
private int stopMaster() { HBaseAdmin adm = null; try { Configuration conf = getConf(); // Don't try more than once conf.setInt("hbase.client.retries.number", 1); adm = new HBaseAdmin(getConf()); } catch (MasterNotRunningException e) { LOG.error("Master not running"); return -1; } catch (ZooKeeperConnectionException e) { LOG.error("ZooKeeper not available"); return -1; } try { adm.shutdown(); } catch (Throwable t) { LOG.error("Failed to stop master", t); return -1; } return 0; }
} catch (ParseException e) { LOG.error("Could not parse: ", e); usage(null); return -1; getConf().setInt("hbase.regions.server.count.min", Integer.valueOf(val)); LOG.debug("minServers set to " + val); getConf().setBoolean(HConstants.MASTER_TYPE_BACKUP, true); usage(null); return -1; return startMaster(); } else if ("stop".equals(command)) { return stopMaster(); } else { usage("Invalid command: " + command); return -1;
/** * @see org.apache.hadoop.hbase.master.HMasterCommandLine */ public static void main(String [] args) { VersionInfo.logVersion(); new HMasterCommandLine(HMaster.class).doMain(args); }
private void waitOnMasterThreads(LocalHBaseCluster cluster) throws InterruptedException{ List<JVMClusterUtil.MasterThread> masters = cluster.getMasters(); List<JVMClusterUtil.RegionServerThread> regionservers = cluster.getRegionServers(); if (masters != null) { for (JVMClusterUtil.MasterThread t : masters) { t.join(); if(t.getMaster().isAborted()) { closeAllRegionServerThreads(regionservers); throw new RuntimeException("HMaster Aborted"); } } } }
} catch (ParseException e) { LOG.error("Could not parse: ", e); usage(null); return 1; getConf().setInt("hbase.regions.server.count.min", Integer.parseInt(val)); LOG.debug("minRegionServers set to " + val); getConf().setInt("hbase.regions.server.count.min", Integer.parseInt(val)); LOG.debug("minServers set to " + val); getConf().setBoolean(HConstants.MASTER_TYPE_BACKUP, true); getConf().setInt("hbase.regionservers", Integer.parseInt(val)); LOG.debug("localRegionServers set to " + val); getConf().setInt("hbase.masters", Integer.parseInt(val)); LOG.debug("masters set to " + val); List<String> remainingArgs = cmd.getArgList(); if (remainingArgs.size() != 1) { usage(null); return 1; return startMaster(); } else if ("stop".equals(command)) { return stopMaster(); } else if ("clear".equals(command)) {
/** * @see org.apache.hadoop.hbase.master.HMasterCommandLine */ public static void main(String [] args) throws Exception { VersionInfo.logVersion(); new HMasterCommandLine(HMaster.class).doMain(args); }
private void waitOnMasterThreads(LocalHBaseCluster cluster) throws InterruptedException{ List<JVMClusterUtil.MasterThread> masters = cluster.getMasters(); List<JVMClusterUtil.RegionServerThread> regionservers = cluster.getRegionServers(); if (masters != null) { for (JVMClusterUtil.MasterThread t : masters) { t.join(); if(t.getMaster().isAborted()) { closeAllRegionServerThreads(regionservers); throw new RuntimeException("HMaster Aborted"); } } } }