|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.util.HasThread
org.apache.hadoop.hbase.master.HMaster
@InterfaceAudience.Private public class HMaster
HMaster is the "master server" for HBase. An HBase cluster has one active master. If many masters are started, all compete. Whichever wins goes on to run the cluster. All others park themselves in their constructor until master or cluster shutdown or until the active master loses its lease in zookeeper. Thereafter, all running master jostle to take over master role.
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
Field Summary | |
---|---|
static String |
MASTER
|
Constructor Summary | |
---|---|
HMaster(org.apache.hadoop.conf.Configuration conf)
Initializes the HMaster. |
Methods inherited from class org.apache.hadoop.hbase.util.HasThread |
---|
getName, getThread, interrupt, isAlive, isInterrupted, join, join, join, setDaemon, setName, setPriority, setUncaughtExceptionHandler, start |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String MASTER
Constructor Detail |
---|
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.
InterruptedException
IOException
org.apache.zookeeper.KeeperException
Method Detail |
---|
public void run()
run
in interface Runnable
run
in class HasThread
protected void startCatalogJanitorChore()
protected void startNamespaceJanitorChore()
public TableDescriptors getTableDescriptors()
getTableDescriptors
in interface MasterServices
public InfoServer getInfoServer()
public org.apache.hadoop.conf.Configuration getConfiguration()
getConfiguration
in interface Server
public ServerManager getServerManager()
getServerManager
in interface MasterServices
ServerManager
instance.public ExecutorService getExecutorService()
getExecutorService
in interface MasterServices
ExecutorService
public MasterFileSystem getMasterFileSystem()
getMasterFileSystem
in interface MasterServices
MasterFileSystem
utility class.public ZooKeeperWatcher getZooKeeperWatcher()
public ActiveMasterManager getActiveMasterManager()
public MasterAddressTracker getMasterAddressManager()
public RegionServerStatusProtos.RegionServerStartupResponse regionServerStartup(com.google.protobuf.RpcController controller, RegionServerStatusProtos.RegionServerStartupRequest request) throws com.google.protobuf.ServiceException
regionServerStartup
in interface RegionServerStatusProtos.RegionServerStatusService.BlockingInterface
com.google.protobuf.ServiceException
protected RegionServerStatusProtos.RegionServerStartupResponse.Builder createConfigurationSubset()
public RegionServerStatusProtos.GetLastFlushedSequenceIdResponse getLastFlushedSequenceId(com.google.protobuf.RpcController controller, RegionServerStatusProtos.GetLastFlushedSequenceIdRequest request) throws com.google.protobuf.ServiceException
getLastFlushedSequenceId
in interface RegionServerStatusProtos.RegionServerStatusService.BlockingInterface
com.google.protobuf.ServiceException
public RegionServerStatusProtos.RegionServerReportResponse regionServerReport(com.google.protobuf.RpcController controller, RegionServerStatusProtos.RegionServerReportRequest request) throws com.google.protobuf.ServiceException
regionServerReport
in interface RegionServerStatusProtos.RegionServerStatusService.BlockingInterface
com.google.protobuf.ServiceException
public RegionServerStatusProtos.ReportRSFatalErrorResponse reportRSFatalError(com.google.protobuf.RpcController controller, RegionServerStatusProtos.ReportRSFatalErrorRequest request) throws com.google.protobuf.ServiceException
reportRSFatalError
in interface RegionServerStatusProtos.RegionServerStatusService.BlockingInterface
com.google.protobuf.ServiceException
public boolean isMasterRunning()
public MasterProtos.IsMasterRunningResponse isMasterRunning(com.google.protobuf.RpcController c, MasterProtos.IsMasterRunningRequest req) throws com.google.protobuf.ServiceException
isMasterRunning
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
isMasterRunning
in interface MasterMonitorProtos.MasterMonitorService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.CatalogScanResponse runCatalogScan(com.google.protobuf.RpcController c, MasterAdminProtos.CatalogScanRequest req) throws com.google.protobuf.ServiceException
runCatalogScan
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.EnableCatalogJanitorResponse enableCatalogJanitor(com.google.protobuf.RpcController c, MasterAdminProtos.EnableCatalogJanitorRequest req) throws com.google.protobuf.ServiceException
enableCatalogJanitor
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.IsCatalogJanitorEnabledResponse isCatalogJanitorEnabled(com.google.protobuf.RpcController c, MasterAdminProtos.IsCatalogJanitorEnabledRequest req) throws com.google.protobuf.ServiceException
isCatalogJanitorEnabled
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public boolean balance() throws HBaseIOException
HBaseIOException
public MasterAdminProtos.BalanceResponse balance(com.google.protobuf.RpcController c, MasterAdminProtos.BalanceRequest request) throws com.google.protobuf.ServiceException
balance
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public boolean switchBalancer(boolean b, org.apache.hadoop.hbase.master.HMaster.BalanceSwitchMode mode) throws IOException
b
- new balancer switchmode
- BalanceSwitchMode
IOException
public boolean synchronousBalanceSwitch(boolean b) throws IOException
IOException
public boolean balanceSwitch(boolean b) throws IOException
IOException
public MasterAdminProtos.SetBalancerRunningResponse setBalancerRunning(com.google.protobuf.RpcController controller, MasterAdminProtos.SetBalancerRunningRequest req) throws com.google.protobuf.ServiceException
setBalancerRunning
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void setCatalogJanitorEnabled(boolean b)
b
- If false, the catalog janitor won't do anything.public MasterAdminProtos.DispatchMergingRegionsResponse dispatchMergingRegions(com.google.protobuf.RpcController controller, MasterAdminProtos.DispatchMergingRegionsRequest request) throws com.google.protobuf.ServiceException
dispatchMergingRegions
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void dispatchMergingRegions(HRegionInfo region_a, HRegionInfo region_b, boolean forcible) throws IOException
MasterServices
dispatchMergingRegions
in interface MasterServices
region_a
- region to mergeregion_b
- region to mergeforcible
- true if do a compulsory merge, otherwise we will only merge
two adjacent regions
IOException
public MasterAdminProtos.MoveRegionResponse moveRegion(com.google.protobuf.RpcController controller, MasterAdminProtos.MoveRegionRequest req) throws com.google.protobuf.ServiceException
moveRegion
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void createTable(HTableDescriptor hTableDescriptor, byte[][] splitKeys) throws IOException
MasterServices
createTable
in interface MasterServices
hTableDescriptor
- The table definitionsplitKeys
- Starting row keys for the initial table regions. If null
a single region is created.
IOException
public MasterAdminProtos.CreateTableResponse createTable(com.google.protobuf.RpcController controller, MasterAdminProtos.CreateTableRequest req) throws com.google.protobuf.ServiceException
createTable
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void deleteTable(TableName tableName) throws IOException
MasterServices
deleteTable
in interface MasterServices
tableName
- The table name
IOException
public MasterAdminProtos.DeleteTableResponse deleteTable(com.google.protobuf.RpcController controller, MasterAdminProtos.DeleteTableRequest request) throws com.google.protobuf.ServiceException
deleteTable
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterMonitorProtos.GetSchemaAlterStatusResponse getSchemaAlterStatus(com.google.protobuf.RpcController controller, MasterMonitorProtos.GetSchemaAlterStatusRequest req) throws com.google.protobuf.ServiceException
getSchemaAlterStatus
in interface MasterMonitorProtos.MasterMonitorService.BlockingInterface
IOException
com.google.protobuf.ServiceException
public void addColumn(TableName tableName, HColumnDescriptor column) throws IOException
MasterServices
addColumn
in interface MasterServices
tableName
- The table namecolumn
- The column definition
IOException
public MasterAdminProtos.AddColumnResponse addColumn(com.google.protobuf.RpcController controller, MasterAdminProtos.AddColumnRequest req) throws com.google.protobuf.ServiceException
addColumn
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void modifyColumn(TableName tableName, HColumnDescriptor descriptor) throws IOException
MasterServices
modifyColumn
in interface MasterServices
tableName
- The table namedescriptor
- The updated column definition
IOException
public MasterAdminProtos.ModifyColumnResponse modifyColumn(com.google.protobuf.RpcController controller, MasterAdminProtos.ModifyColumnRequest req) throws com.google.protobuf.ServiceException
modifyColumn
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void deleteColumn(TableName tableName, byte[] columnName) throws IOException
MasterServices
deleteColumn
in interface MasterServices
tableName
- The table namecolumnName
- The column name
IOException
public MasterAdminProtos.DeleteColumnResponse deleteColumn(com.google.protobuf.RpcController controller, MasterAdminProtos.DeleteColumnRequest req) throws com.google.protobuf.ServiceException
deleteColumn
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void enableTable(TableName tableName) throws IOException
MasterServices
enableTable
in interface MasterServices
tableName
- The table name
IOException
public MasterAdminProtos.EnableTableResponse enableTable(com.google.protobuf.RpcController controller, MasterAdminProtos.EnableTableRequest request) throws com.google.protobuf.ServiceException
enableTable
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void disableTable(TableName tableName) throws IOException
MasterServices
disableTable
in interface MasterServices
tableName
- The table name
IOException
public MasterAdminProtos.DisableTableResponse disableTable(com.google.protobuf.RpcController controller, MasterAdminProtos.DisableTableRequest request) throws com.google.protobuf.ServiceException
disableTable
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void modifyTable(TableName tableName, HTableDescriptor descriptor) throws IOException
MasterServices
modifyTable
in interface MasterServices
tableName
- The table namedescriptor
- The updated table descriptor
IOException
public MasterAdminProtos.ModifyTableResponse modifyTable(com.google.protobuf.RpcController controller, MasterAdminProtos.ModifyTableRequest req) throws com.google.protobuf.ServiceException
modifyTable
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void checkTableModifiable(TableName tableName) throws IOException, TableNotFoundException, TableNotDisabledException
MasterServices
checkTableModifiable
in interface MasterServices
tableName
- Name of table to check.
TableNotDisabledException
TableNotFoundException
IOException
public MasterMonitorProtos.GetClusterStatusResponse getClusterStatus(com.google.protobuf.RpcController controller, MasterMonitorProtos.GetClusterStatusRequest req) throws com.google.protobuf.ServiceException
getClusterStatus
in interface MasterMonitorProtos.MasterMonitorService.BlockingInterface
com.google.protobuf.ServiceException
public ClusterStatus getClusterStatus()
public String getClusterId()
public static String getLoadedCoprocessors()
public long getMasterStartTime()
public long getMasterActiveTime()
public String[] getCoprocessors()
public void abort(String msg, Throwable t)
abort
in interface Abortable
public ZooKeeperWatcher getZooKeeper()
getZooKeeper
in interface Server
public MasterCoprocessorHost getCoprocessorHost()
getCoprocessorHost
in interface MasterServices
MasterCoprocessorHost
public ServerName getServerName()
getServerName
in interface Server
public CatalogTracker getCatalogTracker()
getCatalogTracker
in interface Server
public AssignmentManager getAssignmentManager()
getAssignmentManager
in interface MasterServices
AssignmentManager
public TableLockManager getTableLockManager()
getTableLockManager
in interface MasterServices
TableLockManager
public MemoryBoundedLogMessageBuffer getRegionServerFatalLogBuffer()
public void shutdown()
public MasterAdminProtos.ShutdownResponse shutdown(com.google.protobuf.RpcController controller, MasterAdminProtos.ShutdownRequest request) throws com.google.protobuf.ServiceException
shutdown
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void stopMaster()
public MasterAdminProtos.StopMasterResponse stopMaster(com.google.protobuf.RpcController controller, MasterAdminProtos.StopMasterRequest request) throws com.google.protobuf.ServiceException
stopMaster
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void stop(String why)
stop
in interface Stoppable
public boolean isStopped()
isStopped
in interface Stoppable
public boolean isAborted()
isAborted
in interface Abortable
public boolean isActiveMaster()
public boolean isInitialized()
isInitialized
in interface MasterServices
public boolean isServerShutdownHandlerEnabled()
isServerShutdownHandlerEnabled
in interface MasterServices
public boolean isInitializationStartsMetaRegionAssignment()
public MasterAdminProtos.AssignRegionResponse assignRegion(com.google.protobuf.RpcController controller, MasterAdminProtos.AssignRegionRequest req) throws com.google.protobuf.ServiceException
assignRegion
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void assignRegion(HRegionInfo hri)
public MasterAdminProtos.UnassignRegionResponse unassignRegion(com.google.protobuf.RpcController controller, MasterAdminProtos.UnassignRegionRequest req) throws com.google.protobuf.ServiceException
unassignRegion
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterMonitorProtos.GetTableDescriptorsResponse getTableDescriptors(com.google.protobuf.RpcController controller, MasterMonitorProtos.GetTableDescriptorsRequest req) throws com.google.protobuf.ServiceException
getTableDescriptors
in interface MasterMonitorProtos.MasterMonitorService.BlockingInterface
controller
- Unused (set to null).req
- GetTableDescriptorsRequest that contains:
- tableNames: requested tables, or if empty, all are requested
com.google.protobuf.ServiceException
public MasterMonitorProtos.GetTableNamesResponse getTableNames(com.google.protobuf.RpcController controller, MasterMonitorProtos.GetTableNamesRequest req) throws com.google.protobuf.ServiceException
getTableNames
in interface MasterMonitorProtos.MasterMonitorService.BlockingInterface
controller
- Unused (set to null).req
- GetTableNamesRequest
com.google.protobuf.ServiceException
public double getAverageLoad()
public MasterAdminProtos.OfflineRegionResponse offlineRegion(com.google.protobuf.RpcController controller, MasterAdminProtos.OfflineRegionRequest request) throws com.google.protobuf.ServiceException
offlineRegion
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public boolean registerService(com.google.protobuf.Service instance)
MasterServices
Service
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 MasterServices
instance
- the Service
subclass instance to expose as a coprocessor endpoint
true
if the registration was successful, false
otherwisepublic ClientProtos.CoprocessorServiceResponse execMasterService(com.google.protobuf.RpcController controller, ClientProtos.CoprocessorServiceRequest request) throws com.google.protobuf.ServiceException
execMasterService
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public static HMaster constructMaster(Class<? extends HMaster> masterClass, org.apache.hadoop.conf.Configuration conf)
masterClass
- conf
-
public static void main(String[] args)
HMasterCommandLine
public HFileCleaner getHFileCleaner()
public SnapshotManager getSnapshotManagerForTesting()
public MasterAdminProtos.TakeSnapshotResponse snapshot(com.google.protobuf.RpcController controller, MasterAdminProtos.TakeSnapshotRequest request) throws com.google.protobuf.ServiceException
snapshot
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.ListSnapshotResponse getCompletedSnapshots(com.google.protobuf.RpcController controller, MasterAdminProtos.ListSnapshotRequest request) throws com.google.protobuf.ServiceException
getCompletedSnapshots
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.DeleteSnapshotResponse deleteSnapshot(com.google.protobuf.RpcController controller, MasterAdminProtos.DeleteSnapshotRequest request) throws com.google.protobuf.ServiceException
deleteSnapshot
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
- wrapping SnapshotDoesNotExistException if specified snapshot did not
exist.public MasterAdminProtos.IsSnapshotDoneResponse isSnapshotDone(com.google.protobuf.RpcController controller, MasterAdminProtos.IsSnapshotDoneRequest request) throws com.google.protobuf.ServiceException
isSnapshotDone
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
- wrapping UnknownSnapshotException if invalid snapshot, or
a wrapped HBaseSnapshotException with progress failure reason.public MasterAdminProtos.RestoreSnapshotResponse restoreSnapshot(com.google.protobuf.RpcController controller, MasterAdminProtos.RestoreSnapshotRequest request) throws com.google.protobuf.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 MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.IsRestoreSnapshotDoneResponse isRestoreSnapshotDone(com.google.protobuf.RpcController controller, MasterAdminProtos.IsRestoreSnapshotDoneRequest request) throws com.google.protobuf.ServiceException
isRestoreSnapshotDone
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
- if the operation failed.public MasterAdminProtos.ModifyNamespaceResponse modifyNamespace(com.google.protobuf.RpcController controller, MasterAdminProtos.ModifyNamespaceRequest request) throws com.google.protobuf.ServiceException
modifyNamespace
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.CreateNamespaceResponse createNamespace(com.google.protobuf.RpcController controller, MasterAdminProtos.CreateNamespaceRequest request) throws com.google.protobuf.ServiceException
createNamespace
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.DeleteNamespaceResponse deleteNamespace(com.google.protobuf.RpcController controller, MasterAdminProtos.DeleteNamespaceRequest request) throws com.google.protobuf.ServiceException
deleteNamespace
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.GetNamespaceDescriptorResponse getNamespaceDescriptor(com.google.protobuf.RpcController controller, MasterAdminProtos.GetNamespaceDescriptorRequest request) throws com.google.protobuf.ServiceException
getNamespaceDescriptor
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.ListNamespaceDescriptorsResponse listNamespaceDescriptors(com.google.protobuf.RpcController controller, MasterAdminProtos.ListNamespaceDescriptorsRequest request) throws com.google.protobuf.ServiceException
listNamespaceDescriptors
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.ListTableDescriptorsByNamespaceResponse listTableDescriptorsByNamespace(com.google.protobuf.RpcController controller, MasterAdminProtos.ListTableDescriptorsByNamespaceRequest request) throws com.google.protobuf.ServiceException
listTableDescriptorsByNamespace
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public MasterAdminProtos.ListTableNamesByNamespaceResponse listTableNamesByNamespace(com.google.protobuf.RpcController controller, MasterAdminProtos.ListTableNamesByNamespaceRequest request) throws com.google.protobuf.ServiceException
listTableNamesByNamespace
in interface MasterAdminProtos.MasterAdminService.BlockingInterface
com.google.protobuf.ServiceException
public void createNamespace(NamespaceDescriptor descriptor) throws IOException
MasterServices
createNamespace
in interface MasterServices
descriptor
- descriptor which describes the new namespace
IOException
public void modifyNamespace(NamespaceDescriptor descriptor) throws IOException
MasterServices
modifyNamespace
in interface MasterServices
descriptor
- descriptor which updates the existing namespace
IOException
public void deleteNamespace(String name) throws IOException
MasterServices
deleteNamespace
in interface MasterServices
name
- namespace name
IOException
public NamespaceDescriptor getNamespaceDescriptor(String name) throws IOException
MasterServices
getNamespaceDescriptor
in interface MasterServices
name
- name of namespace descriptor
IOException
public List<NamespaceDescriptor> listNamespaceDescriptors() throws IOException
MasterServices
listNamespaceDescriptors
in interface MasterServices
IOException
public List<HTableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException
MasterServices
listTableDescriptorsByNamespace
in interface MasterServices
name
- namespace name
IOException
public List<TableName> listTableNamesByNamespace(String name) throws IOException
MasterServices
listTableNamesByNamespace
in interface MasterServices
name
- namespace name
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |