@InterfaceAudience.Private public class HMaster extends HasThread implements MasterProtos.MasterService.BlockingInterface, RegionServerStatusProtos.RegionServerStatusService.BlockingInterface, MasterServices, Server
The Master can be asked shutdown the cluster. See shutdown(). In
this case it will tell all regionservers to go down and then wait on them
all reporting in that they are down. This master will then shut itself down.
You can also shutdown just this master. Call stopMaster().
Watcher| Constructor and Description |
|---|
HMaster(org.apache.hadoop.conf.Configuration conf)
Initializes the HMaster.
|
getName, getThread, interrupt, isAlive, isInterrupted, join, join, join, setDaemon, setName, setPriority, setUncaughtExceptionHandler, startpublic static final String MASTER
public HMaster(org.apache.hadoop.conf.Configuration conf)
throws IOException,
org.apache.zookeeper.KeeperException,
InterruptedException
Remaining steps of initialization occur in run() so that they
run in their own thread rather than within the context of the constructor.
InterruptedExceptionIOExceptionorg.apache.zookeeper.KeeperExceptionpublic void run()
protected void startCatalogJanitorChore()
protected void startNamespaceJanitorChore()
public TableDescriptors getTableDescriptors()
getTableDescriptors in interface MasterServicespublic InfoServer getInfoServer()
public org.apache.hadoop.conf.Configuration getConfiguration()
getConfiguration in interface Serverpublic ServerManager getServerManager()
getServerManager in interface MasterServicesServerManager instance.public ExecutorService getExecutorService()
getExecutorService in interface MasterServicesExecutorServicepublic MasterFileSystem getMasterFileSystem()
getMasterFileSystem in interface MasterServicesMasterFileSystem utility class.public ZooKeeperWatcher getZooKeeperWatcher()
public ActiveMasterManager getActiveMasterManager()
public MasterAddressTracker getMasterAddressTracker()
public RegionServerStatusProtos.RegionServerStartupResponse regionServerStartup(RpcController controller, RegionServerStatusProtos.RegionServerStartupRequest request) throws ServiceException
regionServerStartup in interface RegionServerStatusProtos.RegionServerStatusService.BlockingInterfaceServiceExceptionprotected RegionServerStatusProtos.RegionServerStartupResponse.Builder createConfigurationSubset()
public RegionServerStatusProtos.GetLastFlushedSequenceIdResponse getLastFlushedSequenceId(RpcController controller, RegionServerStatusProtos.GetLastFlushedSequenceIdRequest request) throws ServiceException
getLastFlushedSequenceId in interface RegionServerStatusProtos.RegionServerStatusService.BlockingInterfaceServiceExceptionpublic RegionServerStatusProtos.RegionServerReportResponse regionServerReport(RpcController controller, RegionServerStatusProtos.RegionServerReportRequest request) throws ServiceException
regionServerReport in interface RegionServerStatusProtos.RegionServerStatusService.BlockingInterfaceServiceExceptionpublic RegionServerStatusProtos.ReportRSFatalErrorResponse reportRSFatalError(RpcController controller, RegionServerStatusProtos.ReportRSFatalErrorRequest request) throws ServiceException
reportRSFatalError in interface RegionServerStatusProtos.RegionServerStatusService.BlockingInterfaceServiceExceptionpublic boolean isMasterRunning()
public MasterProtos.IsMasterRunningResponse isMasterRunning(RpcController c, MasterProtos.IsMasterRunningRequest req) throws ServiceException
isMasterRunning in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.RunCatalogScanResponse runCatalogScan(RpcController c, MasterProtos.RunCatalogScanRequest req) throws ServiceException
runCatalogScan in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.EnableCatalogJanitorResponse enableCatalogJanitor(RpcController c, MasterProtos.EnableCatalogJanitorRequest req) throws ServiceException
enableCatalogJanitor in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.IsCatalogJanitorEnabledResponse isCatalogJanitorEnabled(RpcController c, MasterProtos.IsCatalogJanitorEnabledRequest req) throws ServiceException
isCatalogJanitorEnabled in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic boolean balance()
throws HBaseIOException
HBaseIOExceptionpublic MasterProtos.BalanceResponse balance(RpcController c, MasterProtos.BalanceRequest request) throws ServiceException
balance in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic boolean switchBalancer(boolean b,
org.apache.hadoop.hbase.master.HMaster.BalanceSwitchMode mode)
throws IOException
b - new balancer switchmode - BalanceSwitchModeIOExceptionpublic boolean synchronousBalanceSwitch(boolean b)
throws IOException
IOExceptionpublic boolean balanceSwitch(boolean b)
throws IOException
IOExceptionpublic MasterProtos.SetBalancerRunningResponse setBalancerRunning(RpcController controller, MasterProtos.SetBalancerRunningRequest req) throws ServiceException
setBalancerRunning in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void setCatalogJanitorEnabled(boolean b)
b - If false, the catalog janitor won't do anything.public MasterProtos.DispatchMergingRegionsResponse dispatchMergingRegions(RpcController controller, MasterProtos.DispatchMergingRegionsRequest request) throws ServiceException
dispatchMergingRegions in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void dispatchMergingRegions(HRegionInfo region_a, HRegionInfo region_b, boolean forcible) throws IOException
MasterServicesdispatchMergingRegions in interface MasterServicesregion_a - region to mergeregion_b - region to mergeforcible - true if do a compulsory merge, otherwise we will only merge
two adjacent regionsIOExceptionpublic MasterProtos.MoveRegionResponse moveRegion(RpcController controller, MasterProtos.MoveRegionRequest req) throws ServiceException
moveRegion in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void createTable(HTableDescriptor hTableDescriptor, byte[][] splitKeys) throws IOException
MasterServicescreateTable in interface MasterServiceshTableDescriptor - The table definitionsplitKeys - Starting row keys for the initial table regions. If null
a single region is created.IOExceptionpublic MasterProtos.CreateTableResponse createTable(RpcController controller, MasterProtos.CreateTableRequest req) throws ServiceException
createTable in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void deleteTable(TableName tableName) throws IOException
MasterServicesdeleteTable in interface MasterServicestableName - The table nameIOExceptionpublic MasterProtos.DeleteTableResponse deleteTable(RpcController controller, MasterProtos.DeleteTableRequest request) throws ServiceException
deleteTable in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.GetSchemaAlterStatusResponse getSchemaAlterStatus(RpcController controller, MasterProtos.GetSchemaAlterStatusRequest req) throws ServiceException
getSchemaAlterStatus in interface MasterProtos.MasterService.BlockingInterfaceIOExceptionServiceExceptionpublic void addColumn(TableName tableName, HColumnDescriptor column) throws IOException
MasterServicesaddColumn in interface MasterServicestableName - The table namecolumn - The column definitionIOExceptionpublic MasterProtos.AddColumnResponse addColumn(RpcController controller, MasterProtos.AddColumnRequest req) throws ServiceException
addColumn in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void modifyColumn(TableName tableName, HColumnDescriptor descriptor) throws IOException
MasterServicesmodifyColumn in interface MasterServicestableName - The table namedescriptor - The updated column definitionIOExceptionpublic MasterProtos.ModifyColumnResponse modifyColumn(RpcController controller, MasterProtos.ModifyColumnRequest req) throws ServiceException
modifyColumn in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void deleteColumn(TableName tableName, byte[] columnName) throws IOException
MasterServicesdeleteColumn in interface MasterServicestableName - The table namecolumnName - The column nameIOExceptionpublic MasterProtos.DeleteColumnResponse deleteColumn(RpcController controller, MasterProtos.DeleteColumnRequest req) throws ServiceException
deleteColumn in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void enableTable(TableName tableName) throws IOException
MasterServicesenableTable in interface MasterServicestableName - The table nameIOExceptionpublic MasterProtos.EnableTableResponse enableTable(RpcController controller, MasterProtos.EnableTableRequest request) throws ServiceException
enableTable in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void disableTable(TableName tableName) throws IOException
MasterServicesdisableTable in interface MasterServicestableName - The table nameIOExceptionpublic MasterProtos.DisableTableResponse disableTable(RpcController controller, MasterProtos.DisableTableRequest request) throws ServiceException
disableTable in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void modifyTable(TableName tableName, HTableDescriptor descriptor) throws IOException
MasterServicesmodifyTable in interface MasterServicestableName - The table namedescriptor - The updated table descriptorIOExceptionpublic MasterProtos.ModifyTableResponse modifyTable(RpcController controller, MasterProtos.ModifyTableRequest req) throws ServiceException
modifyTable in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void checkTableModifiable(TableName tableName) throws IOException, TableNotFoundException, TableNotDisabledException
MasterServicescheckTableModifiable in interface MasterServicestableName - Name of table to check.TableNotDisabledExceptionTableNotFoundExceptionIOExceptionpublic MasterProtos.GetClusterStatusResponse getClusterStatus(RpcController controller, MasterProtos.GetClusterStatusRequest req) throws ServiceException
getClusterStatus in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic ClusterStatus getClusterStatus()
public String getClusterId()
public static String getLoadedCoprocessors()
public long getMasterStartTime()
public long getMasterActiveTime()
public int getRegionServerInfoPort(ServerName sn)
public String[] getCoprocessors()
public ZooKeeperWatcher getZooKeeper()
getZooKeeper in interface Serverpublic MasterCoprocessorHost getCoprocessorHost()
getCoprocessorHost in interface MasterServicesMasterCoprocessorHostpublic ServerName getServerName()
getServerName in interface Serverpublic CatalogTracker getCatalogTracker()
getCatalogTracker in interface Serverpublic AssignmentManager getAssignmentManager()
getAssignmentManager in interface MasterServicesAssignmentManagerpublic TableLockManager getTableLockManager()
getTableLockManager in interface MasterServicesTableLockManagerpublic MemoryBoundedLogMessageBuffer getRegionServerFatalLogBuffer()
public void shutdown()
public MasterProtos.ShutdownResponse shutdown(RpcController controller, MasterProtos.ShutdownRequest request) throws ServiceException
shutdown in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void stopMaster()
public MasterProtos.StopMasterResponse stopMaster(RpcController controller, MasterProtos.StopMasterRequest request) throws ServiceException
stopMaster in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic boolean isActiveMaster()
public boolean isInitialized()
isInitialized in interface MasterServicespublic boolean isServerShutdownHandlerEnabled()
isServerShutdownHandlerEnabled in interface MasterServicespublic boolean isInitializationStartsMetaRegionAssignment()
public MasterProtos.AssignRegionResponse assignRegion(RpcController controller, MasterProtos.AssignRegionRequest req) throws ServiceException
assignRegion in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void assignRegion(HRegionInfo hri)
public MasterProtos.UnassignRegionResponse unassignRegion(RpcController controller, MasterProtos.UnassignRegionRequest req) throws ServiceException
unassignRegion in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.GetTableDescriptorsResponse getTableDescriptors(RpcController controller, MasterProtos.GetTableDescriptorsRequest req) throws ServiceException
getTableDescriptors in interface MasterProtos.MasterService.BlockingInterfacecontroller - Unused (set to null).req - GetTableDescriptorsRequest that contains:
- tableNames: requested tables, or if empty, all are requestedServiceExceptionpublic MasterProtos.GetTableNamesResponse getTableNames(RpcController controller, MasterProtos.GetTableNamesRequest req) throws ServiceException
getTableNames in interface MasterProtos.MasterService.BlockingInterfacecontroller - Unused (set to null).req - GetTableNamesRequestServiceExceptionpublic double getAverageLoad()
public MasterProtos.OfflineRegionResponse offlineRegion(RpcController controller, MasterProtos.OfflineRegionRequest request) throws ServiceException
offlineRegion in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic boolean registerService(Service instance)
MasterServicesService subclass as a master coprocessor endpoint.
Only a single instance may be registered for a given Service subclass (the
instances are keyed on Descriptors.ServiceDescriptor.getFullName().
After the first registration, subsequent calls with the same service name will fail with
a return value of false.
registerService in interface MasterServicesinstance - the Service subclass instance to expose as a coprocessor endpointtrue if the registration was successful, false
otherwisepublic ClientProtos.CoprocessorServiceResponse execMasterService(RpcController controller, ClientProtos.CoprocessorServiceRequest request) throws ServiceException
execMasterService in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic static HMaster constructMaster(Class<? extends HMaster> masterClass, org.apache.hadoop.conf.Configuration conf)
masterClass - conf - public static void main(String[] args)
HMasterCommandLinepublic HFileCleaner getHFileCleaner()
public SnapshotManager getSnapshotManagerForTesting()
public MasterProtos.SnapshotResponse snapshot(RpcController controller, MasterProtos.SnapshotRequest request) throws ServiceException
snapshot in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.GetCompletedSnapshotsResponse getCompletedSnapshots(RpcController controller, MasterProtos.GetCompletedSnapshotsRequest request) throws ServiceException
getCompletedSnapshots in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.DeleteSnapshotResponse deleteSnapshot(RpcController controller, MasterProtos.DeleteSnapshotRequest request) throws ServiceException
deleteSnapshot in interface MasterProtos.MasterService.BlockingInterfaceServiceException - wrapping SnapshotDoesNotExistException if specified snapshot did not
exist.public MasterProtos.IsSnapshotDoneResponse isSnapshotDone(RpcController controller, MasterProtos.IsSnapshotDoneRequest request) throws ServiceException
isSnapshotDone in interface MasterProtos.MasterService.BlockingInterfaceServiceException - wrapping UnknownSnapshotException if invalid snapshot, or
a wrapped HBaseSnapshotException with progress failure reason.public MasterProtos.RestoreSnapshotResponse restoreSnapshot(RpcController controller, MasterProtos.RestoreSnapshotRequest request) throws ServiceException
If the specified table exists a "Restore" is executed, replacing the table schema and directory data with the content of the snapshot. The table must be disabled, or a UnsupportedOperationException will be thrown.
If the table doesn't exist a "Clone" is executed, a new table is created using the schema at the time of the snapshot, and the content of the snapshot.
The restore/clone operation does not require copying HFiles. Since HFiles are immutable the table can point to and use the same files as the original one.
restoreSnapshot in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.IsRestoreSnapshotDoneResponse isRestoreSnapshotDone(RpcController controller, MasterProtos.IsRestoreSnapshotDoneRequest request) throws ServiceException
isRestoreSnapshotDone in interface MasterProtos.MasterService.BlockingInterfaceServiceException - if the operation failed.public MasterProtos.ModifyNamespaceResponse modifyNamespace(RpcController controller, MasterProtos.ModifyNamespaceRequest request) throws ServiceException
modifyNamespace in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.CreateNamespaceResponse createNamespace(RpcController controller, MasterProtos.CreateNamespaceRequest request) throws ServiceException
createNamespace in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.DeleteNamespaceResponse deleteNamespace(RpcController controller, MasterProtos.DeleteNamespaceRequest request) throws ServiceException
deleteNamespace in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.GetNamespaceDescriptorResponse getNamespaceDescriptor(RpcController controller, MasterProtos.GetNamespaceDescriptorRequest request) throws ServiceException
getNamespaceDescriptor in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.ListNamespaceDescriptorsResponse listNamespaceDescriptors(RpcController controller, MasterProtos.ListNamespaceDescriptorsRequest request) throws ServiceException
listNamespaceDescriptors in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.ListTableDescriptorsByNamespaceResponse listTableDescriptorsByNamespace(RpcController controller, MasterProtos.ListTableDescriptorsByNamespaceRequest request) throws ServiceException
listTableDescriptorsByNamespace in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic MasterProtos.ListTableNamesByNamespaceResponse listTableNamesByNamespace(RpcController controller, MasterProtos.ListTableNamesByNamespaceRequest request) throws ServiceException
listTableNamesByNamespace in interface MasterProtos.MasterService.BlockingInterfaceServiceExceptionpublic void createNamespace(NamespaceDescriptor descriptor) throws IOException
MasterServicescreateNamespace in interface MasterServicesdescriptor - descriptor which describes the new namespaceIOExceptionpublic void modifyNamespace(NamespaceDescriptor descriptor) throws IOException
MasterServicesmodifyNamespace in interface MasterServicesdescriptor - descriptor which updates the existing namespaceIOExceptionpublic void deleteNamespace(String name) throws IOException
MasterServicesdeleteNamespace in interface MasterServicesname - namespace nameIOExceptionpublic NamespaceDescriptor getNamespaceDescriptor(String name) throws IOException
MasterServicesgetNamespaceDescriptor in interface MasterServicesname - name of namespace descriptorIOExceptionpublic List<NamespaceDescriptor> listNamespaceDescriptors() throws IOException
MasterServiceslistNamespaceDescriptors in interface MasterServicesIOExceptionpublic List<HTableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException
MasterServiceslistTableDescriptorsByNamespace in interface MasterServicesname - namespace nameIOExceptionpublic List<TableName> listTableNamesByNamespace(String name) throws IOException
MasterServiceslistTableNamesByNamespace in interface MasterServicesname - namespace nameIOExceptionCopyright © 2014 The Apache Software Foundation. All Rights Reserved.