@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; }
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); return stopMaster(); } else if ("clear".equals(command)) { return (ZNodeClearer.clear(getConf()) ? 0 : 1); } else { usage("Invalid command: " + command);
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; }
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); return stopMaster(); } else if ("clear".equals(command)) { return (ZNodeClearer.clear(getConf()) ? 0 : 1); } else { usage("Invalid command: " + command);
private int startMaster() { Configuration conf = getConf(); try {