HBASE-12119 Master regionserver web UI NOT_FOUND

This commit is contained in:
Jimmy Xiang 2014-09-30 10:15:18 -07:00
parent 0075528615
commit c4107d5307
3 changed files with 14 additions and 9 deletions

View File

@ -227,9 +227,6 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
// monitor for distributed procedures
MasterProcedureManagerHost mpmHost;
// A flag to indicate if any table is configured to put on the active master
protected final boolean tablesOnMaster;
private MasterQuotaManager quotaManager;
// handle table states
@ -291,8 +288,6 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
this.masterCheckCompression = conf.getBoolean("hbase.master.check.compression", true);
this.metricsMaster = new MetricsMaster( new MetricsMasterWrapperImpl(this));
String[] tablesOnMaster = BaseLoadBalancer.getTablesOnMaster(conf);
this.tablesOnMaster = tablesOnMaster != null && tablesOnMaster.length > 0;
// Do we publish the status?
boolean shouldPublish = conf.getBoolean(HConstants.STATUS_PUBLISHED,
@ -361,6 +356,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
* Otherwise, loop till the server is stopped or aborted.
*/
protected void waitForMasterActive(){
boolean tablesOnMaster = BaseLoadBalancer.tablesOnMaster(conf);
while (!(tablesOnMaster && isActiveMaster)
&& !isStopped() && !isAborted()) {
sleeper.sleep();
@ -395,7 +391,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
protected void configureInfoServer() {
infoServer.addServlet("master-status", "/master-status", MasterStatusServlet.class);
infoServer.setAttribute(MASTER, this);
if (tablesOnMaster) {
if (BaseLoadBalancer.tablesOnMaster(conf)) {
super.configureInfoServer();
}
}
@ -583,7 +579,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
this.initializationBeforeMetaAssignment = true;
// Wait for regionserver to finish initialization.
if (tablesOnMaster) {
if (BaseLoadBalancer.tablesOnMaster(conf)) {
waitForServerOnline();
}

View File

@ -49,6 +49,7 @@ import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.HConnection;
import org.apache.hadoop.hbase.client.HConnectionManager;
import org.apache.hadoop.hbase.client.RetriesExhaustedException;
import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer;
import org.apache.hadoop.hbase.master.handler.MetaServerShutdownHandler;
import org.apache.hadoop.hbase.master.handler.ServerShutdownHandler;
import org.apache.hadoop.hbase.monitoring.MonitoredTask;
@ -855,7 +856,7 @@ public class ServerManager {
final long timeout = this.master.getConfiguration().
getLong(WAIT_ON_REGIONSERVERS_TIMEOUT, 4500);
int defaultMinToStart = 1;
if (((HMaster)services).tablesOnMaster) {
if (BaseLoadBalancer.tablesOnMaster(master.getConfiguration())) {
// If we assign regions to master, we'd like to start
// at least another region server so that we don't
// assign all regions to master if other region servers

View File

@ -846,7 +846,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
* want to assign any region to the active master, you need to
* configure "hbase.balancer.tablesOnMaster" to "none".
*/
public static String[] getTablesOnMaster(Configuration conf) {
protected static String[] getTablesOnMaster(Configuration conf) {
String valueString = conf.get(TABLES_ON_MASTER);
if (valueString == null) {
return DEFAULT_TABLES_ON_MASTER;
@ -858,6 +858,14 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
return StringUtils.getStrings(valueString);
}
/**
* Check if configured to put any tables on the active master
*/
public static boolean tablesOnMaster(Configuration conf) {
String[] tables = getTablesOnMaster(conf);
return tables != null && tables.length > 0;
}
@Override
public void setConf(Configuration conf) {
setSlop(conf);