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 // monitor for distributed procedures
MasterProcedureManagerHost mpmHost; MasterProcedureManagerHost mpmHost;
// A flag to indicate if any table is configured to put on the active master
protected final boolean tablesOnMaster;
private MasterQuotaManager quotaManager; private MasterQuotaManager quotaManager;
// handle table states // 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.masterCheckCompression = conf.getBoolean("hbase.master.check.compression", true);
this.metricsMaster = new MetricsMaster( new MetricsMasterWrapperImpl(this)); this.metricsMaster = new MetricsMaster( new MetricsMasterWrapperImpl(this));
String[] tablesOnMaster = BaseLoadBalancer.getTablesOnMaster(conf);
this.tablesOnMaster = tablesOnMaster != null && tablesOnMaster.length > 0;
// Do we publish the status? // Do we publish the status?
boolean shouldPublish = conf.getBoolean(HConstants.STATUS_PUBLISHED, 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. * Otherwise, loop till the server is stopped or aborted.
*/ */
protected void waitForMasterActive(){ protected void waitForMasterActive(){
boolean tablesOnMaster = BaseLoadBalancer.tablesOnMaster(conf);
while (!(tablesOnMaster && isActiveMaster) while (!(tablesOnMaster && isActiveMaster)
&& !isStopped() && !isAborted()) { && !isStopped() && !isAborted()) {
sleeper.sleep(); sleeper.sleep();
@ -395,7 +391,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
protected void configureInfoServer() { protected void configureInfoServer() {
infoServer.addServlet("master-status", "/master-status", MasterStatusServlet.class); infoServer.addServlet("master-status", "/master-status", MasterStatusServlet.class);
infoServer.setAttribute(MASTER, this); infoServer.setAttribute(MASTER, this);
if (tablesOnMaster) { if (BaseLoadBalancer.tablesOnMaster(conf)) {
super.configureInfoServer(); super.configureInfoServer();
} }
} }
@ -583,7 +579,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
this.initializationBeforeMetaAssignment = true; this.initializationBeforeMetaAssignment = true;
// Wait for regionserver to finish initialization. // Wait for regionserver to finish initialization.
if (tablesOnMaster) { if (BaseLoadBalancer.tablesOnMaster(conf)) {
waitForServerOnline(); 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.HConnection;
import org.apache.hadoop.hbase.client.HConnectionManager; import org.apache.hadoop.hbase.client.HConnectionManager;
import org.apache.hadoop.hbase.client.RetriesExhaustedException; 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.MetaServerShutdownHandler;
import org.apache.hadoop.hbase.master.handler.ServerShutdownHandler; import org.apache.hadoop.hbase.master.handler.ServerShutdownHandler;
import org.apache.hadoop.hbase.monitoring.MonitoredTask; import org.apache.hadoop.hbase.monitoring.MonitoredTask;
@ -855,7 +856,7 @@ public class ServerManager {
final long timeout = this.master.getConfiguration(). final long timeout = this.master.getConfiguration().
getLong(WAIT_ON_REGIONSERVERS_TIMEOUT, 4500); getLong(WAIT_ON_REGIONSERVERS_TIMEOUT, 4500);
int defaultMinToStart = 1; int defaultMinToStart = 1;
if (((HMaster)services).tablesOnMaster) { if (BaseLoadBalancer.tablesOnMaster(master.getConfiguration())) {
// If we assign regions to master, we'd like to start // If we assign regions to master, we'd like to start
// at least another region server so that we don't // at least another region server so that we don't
// assign all regions to master if other region servers // 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 * want to assign any region to the active master, you need to
* configure "hbase.balancer.tablesOnMaster" to "none". * 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); String valueString = conf.get(TABLES_ON_MASTER);
if (valueString == null) { if (valueString == null) {
return DEFAULT_TABLES_ON_MASTER; return DEFAULT_TABLES_ON_MASTER;
@ -858,6 +858,14 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
return StringUtils.getStrings(valueString); 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 @Override
public void setConf(Configuration conf) { public void setConf(Configuration conf) {
setSlop(conf); setSlop(conf);