@InterfaceAudience.Private @InterfaceStability.Evolving public class HBaseAdmin extends Object implements Admin
Connection.getAdmin()
to obtain an instance of Admin
instead of constructing
an HBaseAdmin directly.
Connection should be an unmanaged connection obtained via
ConnectionFactory.createConnection(Configuration)
ConnectionFactory
,
Connection
,
Admin
Modifier and Type | Class and Description |
---|---|
protected static class |
HBaseAdmin.NamespaceFuture |
protected static class |
HBaseAdmin.ProcedureFuture<V>
Future that waits on a procedure result.
|
protected static class |
HBaseAdmin.TableFuture<V> |
Modifier and Type | Method and Description |
---|---|
void |
abort(String why,
Throwable e)
Abort the server or client.
|
boolean |
abortProcedure(long procId,
boolean mayInterruptIfRunning)
abort a procedure
|
Future<Boolean> |
abortProcedureAsync(long procId,
boolean mayInterruptIfRunning)
Abort a procedure but does not block and wait for it be completely removed.
|
void |
addColumn(TableName tableName,
HColumnDescriptor columnFamily)
Deprecated.
Since 2.0. Will be removed in 3.0. Use
addColumnFamily(TableName, ColumnFamilyDescriptor) instead. |
void |
addColumnFamily(TableName tableName,
ColumnFamilyDescriptor columnFamily)
Add a column family to an existing table.
|
Future<Void> |
addColumnFamilyAsync(TableName tableName,
ColumnFamilyDescriptor columnFamily)
Add a column family to an existing table.
|
void |
addReplicationPeer(String peerId,
ReplicationPeerConfig peerConfig)
Add a new replication peer for replicating data to slave cluster
|
void |
appendReplicationPeerTableCFs(String id,
Map<TableName,? extends Collection<String>> tableCfs)
Append the replicable table-cf config of the specified peer
|
void |
assign(byte[] regionName) |
static void |
available(org.apache.hadoop.conf.Configuration conf)
Is HBase available? Throw an exception if not.
|
boolean |
balancer()
Invoke the balancer.
|
boolean |
balancer(boolean force)
Invoke the balancer.
|
static void |
checkHBaseAvailable(org.apache.hadoop.conf.Configuration conf)
Deprecated.
since hbase-2.0.0 because throws a ServiceException. We don't want to have
protobuf as part of our public API. Use
available(Configuration) |
void |
clearCompactionQueues(ServerName sn,
Set<String> queues)
Clear compacting queues on a regionserver.
|
void |
cloneSnapshot(byte[] snapshotName,
TableName tableName)
Create a new table by cloning the snapshot content.
|
void |
cloneSnapshot(String snapshotName,
TableName tableName)
Create a new table by cloning the snapshot content.
|
void |
cloneSnapshot(String snapshotName,
TableName tableName,
boolean restoreAcl)
Create a new table by cloning the snapshot content.
|
Future<Void> |
cloneSnapshotAsync(String snapshotName,
TableName tableName)
Create a new table by cloning the snapshot content, but does not block
and wait for it be completely cloned.
|
void |
close() |
void |
closeRegion(byte[] regionName,
String unused)
Deprecated.
|
void |
closeRegion(ServerName unused,
HRegionInfo hri)
Deprecated.
|
void |
closeRegion(String regionName,
String unused)
Deprecated.
|
boolean |
closeRegionWithEncodedRegionName(String encodedRegionName,
String unused)
Deprecated.
|
void |
compact(TableName tableName)
Compact a table.
|
void |
compact(TableName tableName,
byte[] columnFamily)
Compact a column family within a table.
|
void |
compact(TableName tableName,
byte[] columnFamily,
CompactType compactType)
Compact a column family within a table.
|
void |
compact(TableName tableName,
CompactType compactType)
Compact a table.
|
void |
compactRegion(byte[] regionName)
Compact an individual region.
|
void |
compactRegion(byte[] regionName,
byte[] columnFamily)
Compact a column family within a region.
|
void |
compactRegionServer(ServerName sn,
boolean major)
Compact all regions on the region server
|
CoprocessorRpcChannel |
coprocessorService()
Creates and returns a
RpcChannel instance connected to the active
master. |
CoprocessorRpcChannel |
coprocessorService(ServerName serverName)
Creates and returns a
RpcChannel instance
connected to the passed region server. |
void |
createNamespace(NamespaceDescriptor descriptor)
Create a new namespace.
|
Future<Void> |
createNamespaceAsync(NamespaceDescriptor descriptor)
Create a new namespace
|
void |
createTable(TableDescriptor desc)
Creates a new table.
|
void |
createTable(TableDescriptor desc,
byte[][] splitKeys)
Creates a new table with an initial set of empty regions defined by the specified split keys.
|
void |
createTable(TableDescriptor desc,
byte[] startKey,
byte[] endKey,
int numRegions)
Creates a new table with the specified number of regions.
|
Future<Void> |
createTableAsync(TableDescriptor desc,
byte[][] splitKeys)
Creates a new table but does not block and wait for it to come online.
|
void |
deleteColumn(TableName tableName,
byte[] columnFamily)
Deprecated.
Since 2.0. Will be removed in 3.0. Use
deleteColumnFamily(TableName, byte[]) instead. |
void |
deleteColumnFamily(TableName tableName,
byte[] columnFamily)
Delete a column family from a table.
|
Future<Void> |
deleteColumnFamilyAsync(TableName tableName,
byte[] columnFamily)
Delete a column family from a table.
|
void |
deleteNamespace(String name)
Delete an existing namespace.
|
Future<Void> |
deleteNamespaceAsync(String name)
Delete an existing namespace.
|
void |
deleteSnapshot(byte[] snapshotName)
Delete an existing snapshot.
|
void |
deleteSnapshot(String snapshotName)
Delete an existing snapshot.
|
void |
deleteSnapshots(Pattern pattern)
Delete existing snapshots whose names match the pattern passed.
|
void |
deleteSnapshots(String regex)
Delete existing snapshots whose names match the pattern passed.
|
void |
deleteTable(TableName tableName)
Deletes a table.
|
Future<Void> |
deleteTableAsync(TableName tableName)
Deletes the table but does not block and wait for it be completely removed.
|
HTableDescriptor[] |
deleteTables(Pattern pattern)
Delete tables matching the passed in pattern and wait on completion.
|
HTableDescriptor[] |
deleteTables(String regex)
Deletes tables matching the passed in pattern and wait on completion.
|
void |
deleteTableSnapshots(Pattern tableNamePattern,
Pattern snapshotNamePattern)
Delete all existing snapshots matching the given table name regular expression and snapshot
name regular expression.
|
void |
deleteTableSnapshots(String tableNameRegex,
String snapshotNameRegex)
Delete all existing snapshots matching the given table name regular expression and snapshot
name regular expression.
|
void |
disableReplicationPeer(String peerId)
Stop the replication stream to the specified peer
|
void |
disableTable(TableName tableName)
Disable table and wait on completion.
|
Future<Void> |
disableTableAsync(TableName tableName)
Disable the table but does not block and wait for it be completely disabled.
|
void |
disableTableReplication(TableName tableName)
Disable a table's replication switch.
|
HTableDescriptor[] |
disableTables(Pattern pattern)
Disable tables matching the passed in pattern and wait on completion.
|
HTableDescriptor[] |
disableTables(String regex)
Disable tables matching the passed in pattern and wait on completion.
|
void |
drainRegionServers(List<ServerName> servers)
Mark a region server as draining to prevent additional regions from getting assigned to it.
|
boolean |
enableCatalogJanitor(boolean enable)
Enable/Disable the catalog janitor
|
void |
enableReplicationPeer(String peerId)
Restart the replication stream to the specified peer
|
void |
enableTable(TableName tableName)
Enable a table.
|
Future<Void> |
enableTableAsync(TableName tableName)
Enable the table but does not block and wait for it be completely enabled.
|
void |
enableTableReplication(TableName tableName)
Enable a table's replication switch.
|
HTableDescriptor[] |
enableTables(Pattern pattern)
Enable tables matching the passed in pattern and wait on completion.
|
HTableDescriptor[] |
enableTables(String regex)
Enable tables matching the passed in pattern and wait on completion.
|
void |
execProcedure(String signature,
String instance,
Map<String,String> props)
Execute a distributed procedure on a cluster.
|
byte[] |
execProcedureWithRet(String signature,
String instance,
Map<String,String> props)
Execute a distributed procedure on a cluster.
|
void |
flush(TableName tableName)
Flush a table.
|
void |
flushRegion(byte[] regionName)
Flush an individual region.
|
Pair<Integer,Integer> |
getAlterStatus(byte[] tableName)
Get the status of alter command - indicates how many regions have received the updated schema
Asynchronous operation.
|
Pair<Integer,Integer> |
getAlterStatus(TableName tableName)
Get the status of alter command - indicates how many regions have received the updated schema
Asynchronous operation.
|
ClusterStatus |
getClusterStatus() |
ClusterStatus |
getClusterStatus(ClusterStatus.Options options)
Get cluster status with options to filter out unwanted status.
|
CompactionState |
getCompactionState(TableName tableName)
Get the current compaction state of a table.
|
CompactionState |
getCompactionState(TableName tableName,
CompactType compactType)
Get the current compaction state of a table.
|
CompactionState |
getCompactionStateForRegion(byte[] regionName)
Get the current compaction state of region.
|
org.apache.hadoop.conf.Configuration |
getConfiguration() |
Connection |
getConnection() |
long |
getLastMajorCompactionTimestamp(TableName tableName)
Get the timestamp of the last major compaction for the passed table
The timestamp of the oldest HFile resulting from a major compaction of that table,
or 0 if no such HFile could be found.
|
long |
getLastMajorCompactionTimestampForRegion(byte[] regionName)
Get the timestamp of the last major compaction for the passed region.
|
String[] |
getMasterCoprocessors()
Helper delegage to getClusterStatus().getMasterCoprocessors().
|
int |
getMasterInfoPort()
Get the info port of the current master if one is available.
|
NamespaceDescriptor |
getNamespaceDescriptor(String name)
Get a namespace descriptor by name
|
List<HRegionInfo> |
getOnlineRegions(ServerName sn)
Get all the online regions on a region server.
|
int |
getOperationTimeout() |
QuotaRetriever |
getQuotaRetriever(QuotaFilter filter)
Return a QuotaRetriever to list the quotas based on the filter.
|
Map<byte[],RegionLoad> |
getRegionLoad(ServerName sn)
Get
RegionLoad of all regions hosted on a regionserver. |
Map<byte[],RegionLoad> |
getRegionLoad(ServerName sn,
TableName tableName)
Get
RegionLoad of all regions hosted on a regionserver for a table. |
ReplicationPeerConfig |
getReplicationPeerConfig(String peerId)
Returns the configured ReplicationPeerConfig for the specified peer
|
List<SecurityCapability> |
getSecurityCapabilities()
Return the set of supported security capabilities.
|
HTableDescriptor |
getTableDescriptor(TableName tableName)
Method for getting the tableDescriptor
|
HTableDescriptor[] |
getTableDescriptors(List<String> names)
Get tableDescriptors
|
HTableDescriptor[] |
getTableDescriptorsByTableName(List<TableName> tableNames)
Get tableDescriptors
|
List<HRegionInfo> |
getTableRegions(TableName tableName)
Get the regions of a given table.
|
boolean |
isAborted()
Check if the server or client was aborted.
|
boolean |
isBalancerEnabled()
Query the current state of the balancer
|
boolean |
isCatalogJanitorEnabled()
Query on the catalog janitor state (Enabled/Disabled?)
|
boolean |
isCleanerChoreEnabled()
Query on the cleaner chore state (Enabled/Disabled?)
|
boolean |
isMasterInMaintenanceMode()
Check whether Master is in maintenance mode
|
boolean |
isNormalizerEnabled()
Query the current state of the region normalizer
|
boolean |
isProcedureFinished(String signature,
String instance,
Map<String,String> props)
Check the current state of the specified procedure.
|
boolean |
isSnapshotFinished(SnapshotDescription snapshotDesc)
Check the current state of the passed snapshot.
|
boolean |
isSplitOrMergeEnabled(MasterSwitchType switchType)
Query the current state of the switch
|
boolean |
isTableAvailable(TableName tableName) |
boolean |
isTableAvailable(TableName tableName,
byte[][] splitKeys)
Use this api to check if the table has been created with the specified number of splitkeys
which was used while creating the given table.
|
boolean |
isTableDisabled(TableName tableName) |
boolean |
isTableEnabled(TableName tableName) |
List<ServerName> |
listDrainingRegionServers()
List region servers marked as draining to not get additional regions assigned to them.
|
LockInfo[] |
listLocks()
List locks.
|
NamespaceDescriptor[] |
listNamespaceDescriptors()
List available namespace descriptors
|
ProcedureInfo[] |
listProcedures()
List procedures
|
List<TableCFs> |
listReplicatedTableCFs()
Find all table and column families that are replicated from this cluster
|
List<ReplicationPeerDescription> |
listReplicationPeers()
Return a list of replication peers.
|
List<ReplicationPeerDescription> |
listReplicationPeers(Pattern pattern)
Return a list of replication peers.
|
List<ReplicationPeerDescription> |
listReplicationPeers(String regex)
Return a list of replication peers.
|
List<SnapshotDescription> |
listSnapshots()
List completed snapshots.
|
List<SnapshotDescription> |
listSnapshots(Pattern pattern)
List all the completed snapshots matching the given pattern.
|
List<SnapshotDescription> |
listSnapshots(String regex)
List all the completed snapshots matching the given regular expression.
|
TableDescriptor |
listTableDescriptor(TableName tableName)
Method for getting the tableDescriptor
|
List<TableDescriptor> |
listTableDescriptors()
List all the userspace tables.
|
List<TableDescriptor> |
listTableDescriptors(List<TableName> tableNames)
Get tableDescriptors
|
List<TableDescriptor> |
listTableDescriptors(Pattern pattern)
List all the userspace tables matching the given pattern.
|
List<TableDescriptor> |
listTableDescriptors(Pattern pattern,
boolean includeSysTables)
List all the tables matching the given pattern.
|
List<TableDescriptor> |
listTableDescriptors(String regex)
List all the userspace tables matching the given regular expression.
|
List<TableDescriptor> |
listTableDescriptors(String regex,
boolean includeSysTables)
List all the tables matching the given pattern.
|
List<TableDescriptor> |
listTableDescriptorsByNamespace(byte[] name)
Get list of table descriptors by namespace
|
HTableDescriptor[] |
listTableDescriptorsByNamespace(String name)
Get list of table descriptors by namespace
|
TableName[] |
listTableNames()
List all of the names of userspace tables.
|
TableName[] |
listTableNames(Pattern pattern)
List all of the names of userspace tables.
|
TableName[] |
listTableNames(Pattern pattern,
boolean includeSysTables)
List all of the names of userspace tables.
|
TableName[] |
listTableNames(String regex)
List all of the names of userspace tables.
|
TableName[] |
listTableNames(String regex,
boolean includeSysTables)
List all of the names of userspace tables.
|
TableName[] |
listTableNamesByNamespace(String name)
Get list of table names by namespace
|
HTableDescriptor[] |
listTables()
List all the userspace tables.
|
HTableDescriptor[] |
listTables(Pattern pattern)
List all the userspace tables matching the given pattern.
|
HTableDescriptor[] |
listTables(Pattern pattern,
boolean includeSysTables)
List all the tables matching the given pattern.
|
HTableDescriptor[] |
listTables(String regex)
List all the userspace tables matching the given regular expression.
|
HTableDescriptor[] |
listTables(String regex,
boolean includeSysTables)
List all the tables matching the given pattern.
|
List<SnapshotDescription> |
listTableSnapshots(Pattern tableNamePattern,
Pattern snapshotNamePattern)
List all the completed snapshots matching the given table name regular expression and snapshot
name regular expression.
|
List<SnapshotDescription> |
listTableSnapshots(String tableNameRegex,
String snapshotNameRegex)
List all the completed snapshots matching the given table name regular expression and snapshot
name regular expression.
|
void |
majorCompact(TableName tableName)
Major compact a table.
|
void |
majorCompact(TableName tableName,
byte[] columnFamily)
Major compact a column family within a table.
|
void |
majorCompact(TableName tableName,
byte[] columnFamily,
CompactType compactType)
Major compact a column family within a table.
|
void |
majorCompact(TableName tableName,
CompactType compactType)
Major compact a table.
|
void |
majorCompactRegion(byte[] regionName)
Major compact a table or an individual region.
|
void |
majorCompactRegion(byte[] regionName,
byte[] columnFamily)
Major compact a column family within region.
|
void |
mergeRegions(byte[] nameOfRegionA,
byte[] nameOfRegionB,
boolean forcible)
Deprecated.
Since 2.0. Will be removed in 3.0. Use
mergeRegionsAsync(byte[], byte[], boolean) instead. |
Future<Void> |
mergeRegionsAsync(byte[][] nameofRegionsToMerge,
boolean forcible)
Merge two regions.
|
Future<Void> |
mergeRegionsAsync(byte[] nameOfRegionA,
byte[] nameOfRegionB,
boolean forcible)
Merge two regions.
|
void |
mergeRegionsSync(byte[] nameOfRegionA,
byte[] nameOfRegionB,
boolean forcible)
Merge two regions.
|
void |
modifyColumn(TableName tableName,
HColumnDescriptor columnFamily)
Deprecated.
As of 2.0. Will be removed in 3.0. Use
modifyColumnFamily(TableName, ColumnFamilyDescriptor) instead. |
void |
modifyColumnFamily(TableName tableName,
ColumnFamilyDescriptor columnFamily)
Modify an existing column family on a table.
|
Future<Void> |
modifyColumnFamilyAsync(TableName tableName,
ColumnFamilyDescriptor columnFamily)
Modify an existing column family on a table.
|
void |
modifyNamespace(NamespaceDescriptor descriptor)
Modify an existing namespace.
|
Future<Void> |
modifyNamespaceAsync(NamespaceDescriptor descriptor)
Modify an existing namespace
|
void |
modifyTable(TableDescriptor td)
Modify an existing table, more IRB friendly version.
|
void |
modifyTable(TableName tableName,
HTableDescriptor htd)
Modify an existing table, more IRB friendly version.
|
Future<Void> |
modifyTableAsync(TableDescriptor td)
Modify an existing table, more IRB friendly version.
|
Future<Void> |
modifyTableAsync(TableName tableName,
HTableDescriptor htd)
Modify an existing table, more IRB friendly version.
|
void |
move(byte[] encodedRegionName,
byte[] destServerName)
Move the region
r to dest . |
boolean |
normalize()
Invoke region normalizer.
|
void |
offline(byte[] regionName)
Offline specified region from master's in-memory state.
|
void |
removeDrainFromRegionServers(List<ServerName> servers)
Remove drain from a region server to allow additional regions assignments.
|
void |
removeReplicationPeer(String peerId)
Remove a peer and stop the replication
|
void |
removeReplicationPeerTableCFs(String id,
Map<TableName,? extends Collection<String>> tableCfs)
Remove some table-cfs from config of the specified peer
|
void |
restoreSnapshot(byte[] snapshotName)
Restore the specified snapshot on the original table.
|
void |
restoreSnapshot(byte[] snapshotName,
boolean takeFailSafeSnapshot)
Restore the specified snapshot on the original table.
|
void |
restoreSnapshot(String snapshotName)
Restore the specified snapshot on the original table.
|
void |
restoreSnapshot(String snapshotName,
boolean takeFailSafeSnapshot)
Restore the specified snapshot on the original table.
|
void |
restoreSnapshot(String snapshotName,
boolean takeFailSafeSnapshot,
boolean restoreAcl)
Restore the specified snapshot on the original table.
|
Future<Void> |
restoreSnapshotAsync(String snapshotName)
Restore the specified snapshot on the original table.
|
byte[][] |
rollHLogWriter(String serverName)
Deprecated.
|
void |
rollWALWriter(ServerName serverName)
Roll the log writer.
|
int |
runCatalogScan()
Ask for a scan of the catalog table
|
boolean |
runCleanerChore()
Ask for cleaner chore to run
|
boolean |
setBalancerRunning(boolean on,
boolean synchronous)
Turn the load balancer on or off.
|
boolean |
setCleanerChoreRunning(boolean on)
Enable/Disable the cleaner chore
|
boolean |
setNormalizerRunning(boolean on)
Turn region normalizer on or off.
|
void |
setQuota(QuotaSettings quota)
Apply the new quota settings.
|
boolean[] |
setSplitOrMergeEnabled(boolean enabled,
boolean synchronous,
MasterSwitchType... switchTypes)
Turn the Split or Merge switches on or off.
|
void |
shutdown()
Shuts down the HBase cluster
|
void |
snapshot(byte[] snapshotName,
TableName tableName)
Create a timestamp consistent snapshot for the given table.
|
void |
snapshot(SnapshotDescription snapshotDesc)
Take a snapshot and wait for the server to complete that snapshot (blocking).
|
void |
snapshot(String snapshotName,
TableName tableName)
Take a snapshot for the given table.
|
void |
snapshot(String snapshotName,
TableName tableName,
SnapshotType type)
Create typed snapshot of the table.
|
void |
split(TableName tableName)
Split a table.
|
void |
split(TableName tableName,
byte[] splitPoint)
Split a table.
|
void |
splitRegion(byte[] regionName)
Split an individual region.
|
void |
splitRegion(byte[] regionName,
byte[] splitPoint)
Split an individual region.
|
Future<Void> |
splitRegionAsync(byte[] regionName,
byte[] splitPoint)
Split an individual region.
|
void |
splitRegionSync(byte[] regionName,
byte[] splitPoint)
Split one region.
|
void |
splitRegionSync(byte[] regionName,
byte[] splitPoint,
long timeout,
TimeUnit units)
Split one region.
|
void |
stopMaster()
Shuts down the current HBase master only.
|
void |
stopRegionServer(String hostnamePort)
Stop the designated regionserver
|
boolean |
tableExists(TableName tableName) |
void |
takeSnapshotAsync(SnapshotDescription snapshotDesc)
Take a snapshot without waiting for the server to complete that snapshot (asynchronous) Only a
single snapshot should be taken at a time, or results may be undefined.
|
void |
truncateTable(TableName tableName,
boolean preserveSplits)
Truncate a table.
|
Future<Void> |
truncateTableAsync(TableName tableName,
boolean preserveSplits)
Truncate the table but does not block and wait for it be completely enabled.
|
void |
unassign(byte[] regionName,
boolean force)
Unassign a region from current hosting regionserver.
|
void |
updateConfiguration()
Update the configuration and trigger an online config change
on all the regionservers
|
void |
updateConfiguration(ServerName server)
Update the configuration and trigger an online config change
on the regionserver
|
void |
updateReplicationPeerConfig(String peerId,
ReplicationPeerConfig peerConfig)
Update the peerConfig for the specified peer
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createTable, createTable, createTable, createTableAsync
public int getOperationTimeout()
getOperationTimeout
in interface Admin
public void abort(String why, Throwable e)
Abortable
public boolean isAborted()
Abortable
public boolean abortProcedure(long procId, boolean mayInterruptIfRunning) throws IOException
Admin
abortProcedure
in interface Admin
procId
- ID of the procedure to abortmayInterruptIfRunning
- if the proc completed at least one step, should it be aborted?IOException
public Future<Boolean> abortProcedureAsync(long procId, boolean mayInterruptIfRunning) throws IOException
Admin
abortProcedureAsync
in interface Admin
procId
- ID of the procedure to abortmayInterruptIfRunning
- if the proc completed at least one step, should it be aborted?IOException
public List<TableDescriptor> listTableDescriptors() throws IOException
Admin
listTableDescriptors
in interface Admin
IOException
- if a remote or network exception occurspublic List<TableDescriptor> listTableDescriptors(Pattern pattern) throws IOException
Admin
listTableDescriptors
in interface Admin
pattern
- The compiled regular expression to match againstIOException
- if a remote or network exception occursAdmin.listTables()
public List<TableDescriptor> listTableDescriptors(String regex) throws IOException
Admin
listTableDescriptors
in interface Admin
regex
- The regular expression to match againstIOException
- if a remote or network exception occursAdmin.listTables(java.util.regex.Pattern)
public List<TableDescriptor> listTableDescriptors(Pattern pattern, boolean includeSysTables) throws IOException
Admin
listTableDescriptors
in interface Admin
pattern
- The compiled regular expression to match againstincludeSysTables
- False to match only against userspace tablesIOException
- if a remote or network exception occursAdmin.listTables()
public List<TableDescriptor> listTableDescriptors(String regex, boolean includeSysTables) throws IOException
Admin
listTableDescriptors
in interface Admin
regex
- The regular expression to match againstincludeSysTables
- False to match only against userspace tablesIOException
- if a remote or network exception occursAdmin.listTables(java.util.regex.Pattern, boolean)
public TableDescriptor listTableDescriptor(TableName tableName) throws TableNotFoundException, IOException
Admin
listTableDescriptor
in interface Admin
tableName
- as a TableName
TableNotFoundException
IOException
- if a remote or network exception occurspublic void modifyTable(TableDescriptor td) throws IOException
Admin
modifyTable
in interface Admin
td
- modified description of the tableIOException
- if a remote or network exception occurspublic Future<Void> modifyTableAsync(TableDescriptor td) throws IOException
Admin
modifyTableAsync
in interface Admin
td
- description of the tableIOException
- if a remote or network exception occurspublic List<TableDescriptor> listTableDescriptorsByNamespace(byte[] name) throws IOException
Admin
listTableDescriptorsByNamespace
in interface Admin
name
- namespace nameIOException
public List<TableDescriptor> listTableDescriptors(List<TableName> tableNames) throws IOException
Admin
listTableDescriptors
in interface Admin
tableNames
- List of table namesIOException
- if a remote or network exception occurspublic Connection getConnection()
getConnection
in interface Admin
public boolean tableExists(TableName tableName) throws IOException
tableExists
in interface Admin
tableName
- Table to check.IOException
public HTableDescriptor[] listTables() throws IOException
Admin
listTables
in interface Admin
IOException
- if a remote or network exception occurspublic HTableDescriptor[] listTables(Pattern pattern) throws IOException
Admin
listTables
in interface Admin
pattern
- The compiled regular expression to match againstIOException
- if a remote or network exception occursAdmin.listTables()
public HTableDescriptor[] listTables(String regex) throws IOException
Admin
listTables
in interface Admin
regex
- The regular expression to match againstIOException
- if a remote or network exception occursAdmin.listTables(java.util.regex.Pattern)
public HTableDescriptor[] listTables(Pattern pattern, boolean includeSysTables) throws IOException
Admin
listTables
in interface Admin
pattern
- The compiled regular expression to match againstincludeSysTables
- False to match only against userspace tablesIOException
- if a remote or network exception occursAdmin.listTables()
public HTableDescriptor[] listTables(String regex, boolean includeSysTables) throws IOException
Admin
listTables
in interface Admin
regex
- The regular expression to match againstincludeSysTables
- False to match only against userspace tablesIOException
- if a remote or network exception occursAdmin.listTables(java.util.regex.Pattern, boolean)
public TableName[] listTableNames() throws IOException
Admin
listTableNames
in interface Admin
IOException
- if a remote or network exception occurspublic TableName[] listTableNames(Pattern pattern) throws IOException
Admin
listTableNames
in interface Admin
pattern
- The regular expression to match againstIOException
- if a remote or network exception occurspublic TableName[] listTableNames(String regex) throws IOException
Admin
listTableNames
in interface Admin
regex
- The regular expression to match againstIOException
- if a remote or network exception occurspublic TableName[] listTableNames(Pattern pattern, boolean includeSysTables) throws IOException
Admin
listTableNames
in interface Admin
pattern
- The regular expression to match againstincludeSysTables
- False to match only against userspace tablesIOException
- if a remote or network exception occurspublic TableName[] listTableNames(String regex, boolean includeSysTables) throws IOException
Admin
listTableNames
in interface Admin
regex
- The regular expression to match againstincludeSysTables
- False to match only against userspace tablesIOException
- if a remote or network exception occurspublic HTableDescriptor getTableDescriptor(TableName tableName) throws IOException
Admin
getTableDescriptor
in interface Admin
tableName
- as a TableName
TableNotFoundException
IOException
- if a remote or network exception occurspublic void createTable(TableDescriptor desc) throws IOException
Admin
createTable
in interface Admin
desc
- table descriptor for tableMasterNotRunningException
- if master is not runningTableExistsException
- if table already exists (If concurrent
threads, the table may have been created between test-for-existence and attempt-at-creation).IOException
- if a remote or network exception occurspublic void createTable(TableDescriptor desc, byte[] startKey, byte[] endKey, int numRegions) throws IOException
Admin
createTable
in interface Admin
desc
- table descriptor for tablestartKey
- beginning of key rangeendKey
- end of key rangenumRegions
- the total number of regions to createMasterNotRunningException
- if master is not runningTableExistsException
- if table already exists (If concurrent
threads, the table may have been created between test-for-existence and attempt-at-creation).IOException
public void createTable(TableDescriptor desc, byte[][] splitKeys) throws IOException
Admin
createTable
in interface Admin
desc
- table descriptor for tablesplitKeys
- array of split keys for the initial regions of the tableMasterNotRunningException
- if master is not runningTableExistsException
- if table already exists (If concurrent
threads, the table may have been created between test-for-existence and attempt-at-creation).IOException
public Future<Void> createTableAsync(TableDescriptor desc, byte[][] splitKeys) throws IOException
Admin
createTableAsync
in interface Admin
desc
- table descriptor for tablesplitKeys
- keys to check if the table has been created with all split keysIOException
- if a remote or network exception occurspublic void deleteTable(TableName tableName) throws IOException
Admin
deleteTable
in interface Admin
tableName
- name of table to deleteIOException
- if a remote or network exception occurspublic Future<Void> deleteTableAsync(TableName tableName) throws IOException
Admin
deleteTableAsync
in interface Admin
tableName
- name of table to deleteIOException
- if a remote or network exception occurspublic HTableDescriptor[] deleteTables(String regex) throws IOException
Admin
Admin.listTableDescriptors(java.lang.String)
and Admin.deleteTable(org.apache.hadoop.hbase.TableName)
deleteTables
in interface Admin
regex
- The regular expression to match table names againstIOException
Admin.deleteTables(java.util.regex.Pattern)
,
Admin.deleteTable(org.apache.hadoop.hbase.TableName)
public HTableDescriptor[] deleteTables(Pattern pattern) throws IOException
listTables(java.util.regex.Pattern)
and
deleteTable(TableName)
deleteTables
in interface Admin
pattern
- The pattern to match table names againstIOException
public void truncateTable(TableName tableName, boolean preserveSplits) throws IOException
Admin
truncateTable
in interface Admin
tableName
- name of table to truncatepreserveSplits
- True if the splits should be preservedIOException
- if a remote or network exception occurspublic Future<Void> truncateTableAsync(TableName tableName, boolean preserveSplits) throws IOException
Admin
truncateTableAsync
in interface Admin
tableName
- name of table to deletepreserveSplits
- true if the splits should be preservedIOException
- if a remote or network exception occurspublic void enableTable(TableName tableName) throws IOException
Admin
Admin.enableTableAsync(org.apache.hadoop.hbase.TableName)
and Admin.isTableEnabled(org.apache.hadoop.hbase.TableName)
instead. The table has to be in
disabled state for it to be enabled.enableTable
in interface Admin
tableName
- name of the tableIOException
- if a remote or network exception occurs There could be couple types of
IOException TableNotFoundException means the table doesn't exist. TableNotDisabledException
means the table isn't in disabled state.Admin.isTableEnabled(org.apache.hadoop.hbase.TableName)
,
Admin.disableTable(org.apache.hadoop.hbase.TableName)
,
Admin.enableTableAsync(org.apache.hadoop.hbase.TableName)
public Future<Void> enableTableAsync(TableName tableName) throws IOException
Admin
enableTableAsync
in interface Admin
tableName
- name of table to deleteIOException
- if a remote or network exception occurspublic HTableDescriptor[] enableTables(String regex) throws IOException
Admin
Admin.listTableDescriptors(java.lang.String)
and Admin.enableTable(org.apache.hadoop.hbase.TableName)
enableTables
in interface Admin
regex
- The regular expression to match table names againstIOException
Admin.enableTables(java.util.regex.Pattern)
,
Admin.enableTable(org.apache.hadoop.hbase.TableName)
public HTableDescriptor[] enableTables(Pattern pattern) throws IOException
Admin
Admin.listTableDescriptors(java.util.regex.Pattern)
and
Admin.enableTable(org.apache.hadoop.hbase.TableName)
enableTables
in interface Admin
pattern
- The pattern to match table names againstIOException
public void disableTable(TableName tableName) throws IOException
Admin
Admin.disableTableAsync(org.apache.hadoop.hbase.TableName)
and
Admin.isTableDisabled(org.apache.hadoop.hbase.TableName)
instead. The table has to be in
enabled state for it to be disabled.disableTable
in interface Admin
IOException
- There could be couple types of IOException TableNotFoundException means the
table doesn't exist. TableNotEnabledException means the table isn't in enabled state.public Future<Void> disableTableAsync(TableName tableName) throws IOException
Admin
disableTableAsync
in interface Admin
tableName
- name of table to deleteIOException
- if a remote or network exception occurspublic HTableDescriptor[] disableTables(String regex) throws IOException
Admin
Admin.listTableDescriptors(java.lang.String)
and Admin.disableTable(org.apache.hadoop.hbase.TableName)
disableTables
in interface Admin
regex
- The regular expression to match table names againstIOException
Admin.disableTables(java.util.regex.Pattern)
,
Admin.disableTable(org.apache.hadoop.hbase.TableName)
public HTableDescriptor[] disableTables(Pattern pattern) throws IOException
Admin
Admin.listTableDescriptors(java.util.regex.Pattern)
and
Admin.disableTable(org.apache.hadoop.hbase.TableName)
disableTables
in interface Admin
pattern
- The pattern to match table names againstIOException
public boolean isTableEnabled(TableName tableName) throws IOException
isTableEnabled
in interface Admin
tableName
- name of table to checkIOException
- if a remote or network exception occurspublic boolean isTableDisabled(TableName tableName) throws IOException
isTableDisabled
in interface Admin
tableName
- name of table to checkIOException
- if a remote or network exception occurspublic boolean isTableAvailable(TableName tableName) throws IOException
isTableAvailable
in interface Admin
tableName
- name of table to checkIOException
- if a remote or network exception occurspublic boolean isTableAvailable(TableName tableName, byte[][] splitKeys) throws IOException
Admin
isTableAvailable
in interface Admin
tableName
- name of table to checksplitKeys
- keys to check if the table has been created with all split keysIOException
- if a remote or network excpetion occurspublic Pair<Integer,Integer> getAlterStatus(TableName tableName) throws IOException
Admin
getAlterStatus
in interface Admin
tableName
- TableName instanceIOException
- if a remote or network exception occurspublic Pair<Integer,Integer> getAlterStatus(byte[] tableName) throws IOException
Admin
getAlterStatus
in interface Admin
tableName
- name of the table to get the status ofIOException
- if a remote or network exception occurs@Deprecated public void addColumn(TableName tableName, HColumnDescriptor columnFamily) throws IOException
addColumnFamily(TableName, ColumnFamilyDescriptor)
instead.addColumn
in interface Admin
tableName
- name of the table to add column family tocolumnFamily
- column family descriptor of column family to be addedIOException
- if a remote or network exception occurspublic void addColumnFamily(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException
Admin
addColumnFamily
in interface Admin
tableName
- name of the table to add column family tocolumnFamily
- column family descriptor of column family to be addedIOException
- if a remote or network exception occurspublic Future<Void> addColumnFamilyAsync(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException
Admin
addColumnFamilyAsync
in interface Admin
tableName
- name of the table to add column family tocolumnFamily
- column family descriptor of column family to be addedIOException
- if a remote or network exception occurs@Deprecated public void deleteColumn(TableName tableName, byte[] columnFamily) throws IOException
deleteColumnFamily(TableName, byte[])
instead.deleteColumn
in interface Admin
tableName
- name of tablecolumnFamily
- name of column family to be deletedIOException
- if a remote or network exception occurspublic void deleteColumnFamily(TableName tableName, byte[] columnFamily) throws IOException
Admin
deleteColumnFamily
in interface Admin
tableName
- name of tablecolumnFamily
- name of column family to be deletedIOException
- if a remote or network exception occurspublic Future<Void> deleteColumnFamilyAsync(TableName tableName, byte[] columnFamily) throws IOException
Admin
deleteColumnFamilyAsync
in interface Admin
tableName
- name of tablecolumnFamily
- name of column family to be deletedIOException
- if a remote or network exception occurs@Deprecated public void modifyColumn(TableName tableName, HColumnDescriptor columnFamily) throws IOException
modifyColumnFamily(TableName, ColumnFamilyDescriptor)
instead.modifyColumn
in interface Admin
tableName
- name of tablecolumnFamily
- new column family descriptor to useIOException
- if a remote or network exception occurspublic void modifyColumnFamily(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException
Admin
modifyColumnFamily
in interface Admin
tableName
- name of tablecolumnFamily
- new column family descriptor to useIOException
- if a remote or network exception occurspublic Future<Void> modifyColumnFamilyAsync(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException
Admin
modifyColumnFamilyAsync
in interface Admin
tableName
- name of tablecolumnFamily
- new column family descriptor to useIOException
- if a remote or network exception occurs@Deprecated public void closeRegion(String regionName, String unused) throws IOException
Admin
Admin.unassign(byte[], boolean)
to unassign the region. For expert-admins.closeRegion
in interface Admin
regionName
- region name to closeunused
- Deprecated. Not used.IOException
- if a remote or network exception occurs@Deprecated public void closeRegion(byte[] regionName, String unused) throws IOException
Admin
Admin.unassign(byte[], boolean)
to unassign the region. For expert-admins.closeRegion
in interface Admin
regionName
- region name to closeunused
- Deprecated. Not used.IOException
- if a remote or network exception occurs@Deprecated public boolean closeRegionWithEncodedRegionName(String encodedRegionName, String unused) throws IOException
Admin
Admin.unassign(byte[], boolean)
to unassign the region. For expert-admins.closeRegionWithEncodedRegionName
in interface Admin
encodedRegionName
- The encoded region name; i.e. the hash that makes up the region name
suffix: e.g. if regionname is
TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.
,
then the encoded region name is: 527db22f95c8a9e0116f0cc13c680396
.unused
- Deprecated. Not used.IOException
- if a remote or network exception occurs@Deprecated public void closeRegion(ServerName unused, HRegionInfo hri) throws IOException
Admin
Admin.unassign(byte[], boolean)
to unassign the region. For expert-admins.closeRegion
in interface Admin
unused
- Deprecated. Not used.IOException
public List<HRegionInfo> getOnlineRegions(ServerName sn) throws IOException
Admin
getOnlineRegions
in interface Admin
IOException
public void flush(TableName tableName) throws IOException
Admin
flush
in interface Admin
tableName
- table to flushIOException
- if a remote or network exception occurspublic void flushRegion(byte[] regionName) throws IOException
Admin
flushRegion
in interface Admin
regionName
- region to flushIOException
- if a remote or network exception occurspublic void compact(TableName tableName) throws IOException
compact
in interface Admin
tableName
- table to compactIOException
- if a remote or network exception occurspublic void compactRegion(byte[] regionName) throws IOException
Admin
compactRegion
in interface Admin
regionName
- region to compactIOException
- if a remote or network exception occurspublic void compact(TableName tableName, byte[] columnFamily) throws IOException
compact
in interface Admin
tableName
- table to compactcolumnFamily
- column family within a tableIOException
- if a remote or network exception occurspublic void compactRegion(byte[] regionName, byte[] columnFamily) throws IOException
compactRegion
in interface Admin
regionName
- region to compactcolumnFamily
- column family within a regionIOException
- if a remote or network exception occurspublic void compactRegionServer(ServerName sn, boolean major) throws IOException, InterruptedException
compactRegionServer
in interface Admin
sn
- the region server namemajor
- if it's major compactionIOException
InterruptedException
public void majorCompact(TableName tableName) throws IOException
Admin
majorCompact
in interface Admin
tableName
- table to major compactIOException
- if a remote or network exception occurspublic void majorCompactRegion(byte[] regionName) throws IOException
Admin
majorCompactRegion
in interface Admin
regionName
- region to major compactIOException
- if a remote or network exception occurspublic void majorCompact(TableName tableName, byte[] columnFamily) throws IOException
majorCompact
in interface Admin
tableName
- table to major compactcolumnFamily
- column family within a tableIOException
- if a remote or network exception occurspublic void majorCompactRegion(byte[] regionName, byte[] columnFamily) throws IOException
Admin
majorCompactRegion
in interface Admin
regionName
- egion to major compactcolumnFamily
- column family within a regionIOException
- if a remote or network exception occurspublic void move(byte[] encodedRegionName, byte[] destServerName) throws IOException
Admin
r
to dest
.move
in interface Admin
encodedRegionName
- The encoded region name; i.e. the hash that makes up the region name
suffix: e.g. if regionname is
TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.
,
then the encoded region name is: 527db22f95c8a9e0116f0cc13c680396
.destServerName
- The servername of the destination regionserver. If passed the empty byte
array we'll assign to a random server. A server name is made of host, port and startcode.
Here is an example: host187.example.com,60020,1289493121758
IOException
- if we can't find a region named
encodedRegionName
public void assign(byte[] regionName) throws MasterNotRunningException, ZooKeeperConnectionException, IOException
assign
in interface Admin
regionName
- Region name to assign.MasterNotRunningException
ZooKeeperConnectionException
IOException
public void unassign(byte[] regionName, boolean force) throws IOException
Admin
Admin.move(byte[], byte[])
if you want to control the region movement.unassign
in interface Admin
regionName
- Region to unassign. Will clear any existing RegionPlan if one found.force
- If true, force unassign (Will remove region from regions-in-transition too if
present. If results in double assignment use hbck -fix to resolve. To be used by experts).IOException
public void offline(byte[] regionName) throws IOException
Admin
offline
in interface Admin
regionName
- Region to offline.IOException
public boolean setBalancerRunning(boolean on, boolean synchronous) throws IOException
Admin
setBalancerRunning
in interface Admin
synchronous
- If true, it waits until current balance() call, if outstanding, to return.IOException
public boolean balancer() throws IOException
Admin
balancer
in interface Admin
IOException
public boolean balancer(boolean force) throws IOException
Admin
balancer
in interface Admin
force
- whether we should force balance even if there is region in transitionIOException
public boolean isBalancerEnabled() throws IOException
Admin
isBalancerEnabled
in interface Admin
IOException
public boolean normalize() throws IOException
Admin
normalize
in interface Admin
IOException
public boolean isNormalizerEnabled() throws IOException
Admin
isNormalizerEnabled
in interface Admin
IOException
public boolean setNormalizerRunning(boolean on) throws IOException
Admin
setNormalizerRunning
in interface Admin
IOException
public boolean enableCatalogJanitor(boolean enable) throws IOException
Admin
enableCatalogJanitor
in interface Admin
enable
- if true enables the catalog janitorIOException
public int runCatalogScan() throws IOException
Admin
runCatalogScan
in interface Admin
IOException
public boolean isCatalogJanitorEnabled() throws IOException
Admin
isCatalogJanitorEnabled
in interface Admin
IOException
public boolean setCleanerChoreRunning(boolean on) throws IOException
Admin
setCleanerChoreRunning
in interface Admin
on
- if true enables the cleaner choreIOException
public boolean runCleanerChore() throws IOException
Admin
runCleanerChore
in interface Admin
IOException
public boolean isCleanerChoreEnabled() throws IOException
Admin
isCleanerChoreEnabled
in interface Admin
IOException
public void mergeRegionsSync(byte[] nameOfRegionA, byte[] nameOfRegionB, boolean forcible) throws IOException
nameOfRegionA
- encoded or full name of region anameOfRegionB
- encoded or full name of region bforcible
- true if do a compulsory merge, otherwise we will only merge
two adjacent regionsIOException
@Deprecated public void mergeRegions(byte[] nameOfRegionA, byte[] nameOfRegionB, boolean forcible) throws IOException
mergeRegionsAsync(byte[], byte[], boolean)
instead.mergeRegions
in interface Admin
nameOfRegionA
- encoded or full name of region anameOfRegionB
- encoded or full name of region bforcible
- true if do a compulsory merge, otherwise we will only merge
two adjacent regionsIOException
public Future<Void> mergeRegionsAsync(byte[] nameOfRegionA, byte[] nameOfRegionB, boolean forcible) throws IOException
mergeRegionsAsync
in interface Admin
nameOfRegionA
- encoded or full name of region anameOfRegionB
- encoded or full name of region bforcible
- true if do a compulsory merge, otherwise we will only merge
two adjacent regionsIOException
public Future<Void> mergeRegionsAsync(byte[][] nameofRegionsToMerge, boolean forcible) throws IOException
mergeRegionsAsync
in interface Admin
nameofRegionsToMerge
- encoded or full name of daughter regionsforcible
- true if do a compulsory merge, otherwise we will only merge
adjacent regionsIOException
public void splitRegionSync(byte[] regionName, byte[] splitPoint) throws IOException
regionName
- encoded or full name of regionsplitPoint
- key where region splitsIOException
public void splitRegionSync(byte[] regionName, byte[] splitPoint, long timeout, TimeUnit units) throws IOException
regionName
- region to be splitsplitPoint
- split pointtimeout
- how long to wait on splitunits
- time unitsIOException
public Future<Void> splitRegionAsync(byte[] regionName, byte[] splitPoint) throws IOException
Admin
splitRegionAsync
in interface Admin
regionName
- region to splitsplitPoint
- the explicit position to split onIOException
- if a remote or network exception occurspublic void split(TableName tableName) throws IOException
Admin
split
in interface Admin
tableName
- table to splitIOException
- if a remote or network exception occurspublic void splitRegion(byte[] regionName) throws IOException
Admin
splitRegion
in interface Admin
regionName
- region to splitIOException
- if a remote or network exception occurspublic void split(TableName tableName, byte[] splitPoint) throws IOException
Admin
split
in interface Admin
tableName
- table to splitsplitPoint
- the explicit position to split onIOException
- if a remote or network exception occurspublic void splitRegion(byte[] regionName, byte[] splitPoint) throws IOException
Admin
splitRegion
in interface Admin
regionName
- region to splitsplitPoint
- the explicit position to split onIOException
- if a remote or network exception occurspublic void modifyTable(TableName tableName, HTableDescriptor htd) throws IOException
Admin
modifyTable
in interface Admin
tableName
- name of table.htd
- modified description of the tableIOException
- if a remote or network exception occurspublic Future<Void> modifyTableAsync(TableName tableName, HTableDescriptor htd) throws IOException
Admin
modifyTableAsync
in interface Admin
tableName
- name of table.htd
- modified description of the tableIOException
- if a remote or network exception occurspublic void shutdown() throws IOException
Admin
shutdown
in interface Admin
IOException
- if a remote or network exception occurspublic void stopMaster() throws IOException
Admin
stopMaster
in interface Admin
IOException
- if a remote or network exception occursAdmin.shutdown()
public void stopRegionServer(String hostnamePort) throws IOException
Admin
stopRegionServer
in interface Admin
hostnamePort
- Hostname and port delimited by a :
as in
example.org:1234
IOException
- if a remote or network exception occurspublic boolean isMasterInMaintenanceMode() throws IOException
Admin
isMasterInMaintenanceMode
in interface Admin
IOException
- if a remote or network exception occurspublic ClusterStatus getClusterStatus() throws IOException
getClusterStatus
in interface Admin
IOException
- if a remote or network exception occurspublic ClusterStatus getClusterStatus(ClusterStatus.Options options) throws IOException
Admin
getClusterStatus
in interface Admin
IOException
- if a remote or network exception occurspublic Map<byte[],RegionLoad> getRegionLoad(ServerName sn) throws IOException
Admin
RegionLoad
of all regions hosted on a regionserver.getRegionLoad
in interface Admin
sn
- region server from which regionload is required.IOException
- if a remote or network exception occurspublic Map<byte[],RegionLoad> getRegionLoad(ServerName sn, TableName tableName) throws IOException
Admin
RegionLoad
of all regions hosted on a regionserver for a table.getRegionLoad
in interface Admin
sn
- region server from which regionload is required.tableName
- get region load of regions belonging to the tableIOException
- if a remote or network exception occurspublic org.apache.hadoop.conf.Configuration getConfiguration()
getConfiguration
in interface Admin
public void createNamespace(NamespaceDescriptor descriptor) throws IOException
Admin
createNamespace
in interface Admin
descriptor
- descriptor which describes the new namespaceIOException
public Future<Void> createNamespaceAsync(NamespaceDescriptor descriptor) throws IOException
Admin
createNamespaceAsync
in interface Admin
descriptor
- descriptor which describes the new namespaceIOException
public void modifyNamespace(NamespaceDescriptor descriptor) throws IOException
Admin
modifyNamespace
in interface Admin
descriptor
- descriptor which describes the new namespaceIOException
public Future<Void> modifyNamespaceAsync(NamespaceDescriptor descriptor) throws IOException
Admin
modifyNamespaceAsync
in interface Admin
descriptor
- descriptor which describes the new namespaceIOException
public void deleteNamespace(String name) throws IOException
Admin
deleteNamespace
in interface Admin
name
- namespace nameIOException
public Future<Void> deleteNamespaceAsync(String name) throws IOException
Admin
deleteNamespaceAsync
in interface Admin
name
- namespace nameIOException
public NamespaceDescriptor getNamespaceDescriptor(String name) throws NamespaceNotFoundException, IOException
Admin
getNamespaceDescriptor
in interface Admin
name
- name of namespace descriptorNamespaceNotFoundException
IOException
- if a remote or network exception occurspublic NamespaceDescriptor[] listNamespaceDescriptors() throws IOException
Admin
listNamespaceDescriptors
in interface Admin
IOException
public ProcedureInfo[] listProcedures() throws IOException
Admin
listProcedures
in interface Admin
IOException
public LockInfo[] listLocks() throws IOException
Admin
listLocks
in interface Admin
IOException
- if a remote or network exception occurspublic HTableDescriptor[] listTableDescriptorsByNamespace(String name) throws IOException
Admin
listTableDescriptorsByNamespace
in interface Admin
name
- namespace nameIOException
public TableName[] listTableNamesByNamespace(String name) throws IOException
Admin
listTableNamesByNamespace
in interface Admin
name
- namespace nameIOException
@Deprecated public static void checkHBaseAvailable(org.apache.hadoop.conf.Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException, com.google.protobuf.ServiceException
available(Configuration)
conf
- system configurationMasterNotRunningException
- if the master is not runningZooKeeperConnectionException
- if unable to connect to zookeeperIOException
com.google.protobuf.ServiceException
public static void available(org.apache.hadoop.conf.Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException
conf
- system configurationMasterNotRunningException
- if the master is not running.ZooKeeperConnectionException
- if unable to connect to zookeeper.
// TODO do not expose ZKConnectionException.IOException
public List<HRegionInfo> getTableRegions(TableName tableName) throws IOException
Admin
getTableRegions
in interface Admin
tableName
- the name of the tableHRegionInfo
.IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Admin
IOException
public HTableDescriptor[] getTableDescriptorsByTableName(List<TableName> tableNames) throws IOException
Admin
getTableDescriptorsByTableName
in interface Admin
tableNames
- List of table namesIOException
- if a remote or network exception occurspublic HTableDescriptor[] getTableDescriptors(List<String> names) throws IOException
Admin
getTableDescriptors
in interface Admin
names
- List of table namesIOException
- if a remote or network exception occurs@Deprecated public byte[][] rollHLogWriter(String serverName) throws IOException, FailedLogCloseException
rollWALWriter(ServerName)
serverName
- The servername of the regionserver. A server name is made of host,
port and startcode. This is mandatory. Here is an example:
host187.example.com,60020,1289493121758
HRegionInfo.getEncodedName()
that would allow the wal to
clean up some underlying files. null if there's nothing to flush.IOException
- if a remote or network exception occursFailedLogCloseException
public void rollWALWriter(ServerName serverName) throws IOException, FailedLogCloseException
Admin
rollWALWriter
in interface Admin
serverName
- The servername of the regionserver.IOException
- if a remote or network exception occursFailedLogCloseException
public String[] getMasterCoprocessors()
Admin
getMasterCoprocessors
in interface Admin
ClusterStatus.getMasterCoprocessors()
public CompactionState getCompactionState(TableName tableName) throws IOException
Admin
getCompactionState
in interface Admin
tableName
- table to examineIOException
- if a remote or network exception occurspublic CompactionState getCompactionStateForRegion(byte[] regionName) throws IOException
Admin
getCompactionStateForRegion
in interface Admin
regionName
- region to examineIOException
- if a remote or network exception occurspublic void snapshot(String snapshotName, TableName tableName) throws IOException, SnapshotCreationException, IllegalArgumentException
Admin
SnapshotCreationException
indicating the duplicate naming.
Snapshot names follow the same naming constraints as tables in HBase. See TableName.isLegalFullyQualifiedTableName(byte[])
.snapshot
in interface Admin
snapshotName
- name of the snapshot to be createdtableName
- name of the table for which snapshot is createdIOException
- if a remote or network exception occursSnapshotCreationException
- if snapshot creation failedIllegalArgumentException
- if the snapshot request is formatted incorrectlypublic void snapshot(byte[] snapshotName, TableName tableName) throws IOException, SnapshotCreationException, IllegalArgumentException
Admin
SnapshotCreationException
indicating the duplicate naming. Snapshot names follow the same naming constraints as tables in
HBase.snapshot
in interface Admin
snapshotName
- name of the snapshot to be createdtableName
- name of the table for which snapshot is createdIOException
- if a remote or network exception occursSnapshotCreationException
- if snapshot creation failedIllegalArgumentException
- if the snapshot request is formatted incorrectlypublic void snapshot(String snapshotName, TableName tableName, SnapshotType type) throws IOException, SnapshotCreationException, IllegalArgumentException
Admin
SnapshotCreationException
indicating the
duplicate naming. Snapshot names follow the same naming constraints as tables in HBase. See
TableName.isLegalFullyQualifiedTableName(byte[])
.snapshot
in interface Admin
snapshotName
- name to give the snapshot on the filesystem. Must be unique from all other
snapshots stored on the clustertableName
- name of the table to snapshottype
- type of snapshot to takeIOException
- we fail to reach the masterSnapshotCreationException
- if snapshot creation failedIllegalArgumentException
- if the snapshot request is formatted incorrectlypublic void snapshot(SnapshotDescription snapshotDesc) throws IOException, SnapshotCreationException, IllegalArgumentException
Admin
SnapshotCreationException
indicating the duplicate naming.
Snapshot names follow the same naming constraints as tables in HBase. See TableName.isLegalFullyQualifiedTableName(byte[])
. You should probably
use Admin.snapshot(String, org.apache.hadoop.hbase.TableName)
or
Admin.snapshot(byte[], org.apache.hadoop.hbase.TableName)
unless you are sure about the type
of snapshot that you want to take.snapshot
in interface Admin
snapshotDesc
- snapshot to takeIOException
- or we lose contact with the master.SnapshotCreationException
- if snapshot failed to be takenIllegalArgumentException
- if the snapshot request is formatted incorrectlypublic void takeSnapshotAsync(SnapshotDescription snapshotDesc) throws IOException, SnapshotCreationException
Admin
takeSnapshotAsync
in interface Admin
snapshotDesc
- snapshot to takeIOException
- if the snapshot did not succeed or we lose contact with the master.SnapshotCreationException
- if snapshot creation failedpublic boolean isSnapshotFinished(SnapshotDescription snapshotDesc) throws IOException, HBaseSnapshotException, UnknownSnapshotException
Admin
UnknownSnapshotException
.isSnapshotFinished
in interface Admin
snapshotDesc
- description of the snapshot to checkIOException
- if we have a network issueHBaseSnapshotException
- if the snapshot failedUnknownSnapshotException
- if the requested snapshot is
unknownpublic void restoreSnapshot(byte[] snapshotName) throws IOException, RestoreSnapshotException
Admin
restoreSnapshot
in interface Admin
snapshotName
- name of the snapshot to restoreIOException
- if a remote or network exception occursRestoreSnapshotException
- if snapshot failed to be
restoredpublic void restoreSnapshot(String snapshotName) throws IOException, RestoreSnapshotException
Admin
restoreSnapshot
in interface Admin
snapshotName
- name of the snapshot to restoreIOException
- if a remote or network exception occursRestoreSnapshotException
- if snapshot failed to be restoredpublic void restoreSnapshot(byte[] snapshotName, boolean takeFailSafeSnapshot) throws IOException, RestoreSnapshotException
Admin
restoreSnapshot
in interface Admin
snapshotName
- name of the snapshot to restoretakeFailSafeSnapshot
- true if the failsafe snapshot should be takenIOException
- if a remote or network exception occursRestoreSnapshotException
- if snapshot failed to be restoredpublic void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot) throws IOException, RestoreSnapshotException
Admin
restoreSnapshot
in interface Admin
snapshotName
- name of the snapshot to restoretakeFailSafeSnapshot
- true if the failsafe snapshot should be takenIOException
- if a remote or network exception occursRestoreSnapshotException
- if snapshot failed to be restoredpublic void restoreSnapshot(String snapshotName, boolean takeFailSafeSnapshot, boolean restoreAcl) throws IOException, RestoreSnapshotException
Admin
restoreSnapshot
in interface Admin
snapshotName
- name of the snapshot to restoretakeFailSafeSnapshot
- true if the failsafe snapshot should be takenrestoreAcl
- true to restore acl of snapshotIOException
- if a remote or network exception occursRestoreSnapshotException
- if snapshot failed to be restoredpublic Future<Void> restoreSnapshotAsync(String snapshotName) throws IOException, RestoreSnapshotException
Admin
restoreSnapshotAsync
in interface Admin
snapshotName
- name of the snapshot to restoreIOException
- if a remote or network exception occursRestoreSnapshotException
- if snapshot failed to be restoredpublic void cloneSnapshot(byte[] snapshotName, TableName tableName) throws IOException, TableExistsException, RestoreSnapshotException
Admin
cloneSnapshot
in interface Admin
snapshotName
- name of the snapshot to be clonedtableName
- name of the table where the snapshot will be restoredIOException
- if a remote or network exception occursTableExistsException
- if table to be created already existsRestoreSnapshotException
- if snapshot failed to be clonedpublic void cloneSnapshot(String snapshotName, TableName tableName, boolean restoreAcl) throws IOException, TableExistsException, RestoreSnapshotException
Admin
cloneSnapshot
in interface Admin
snapshotName
- name of the snapshot to be clonedtableName
- name of the table where the snapshot will be restoredrestoreAcl
- true to clone acl into newly created tableIOException
- if a remote or network exception occursTableExistsException
- if table to be created already existsRestoreSnapshotException
- if snapshot failed to be clonedpublic void cloneSnapshot(String snapshotName, TableName tableName) throws IOException, TableExistsException, RestoreSnapshotException
Admin
cloneSnapshot
in interface Admin
snapshotName
- name of the snapshot to be clonedtableName
- name of the table where the snapshot will be restoredIOException
- if a remote or network exception occursTableExistsException
- if table to be created already existsRestoreSnapshotException
- if snapshot failed to be clonedpublic Future<Void> cloneSnapshotAsync(String snapshotName, TableName tableName) throws IOException, TableExistsException
Admin
cloneSnapshotAsync
in interface Admin
snapshotName
- name of the snapshot to be clonedtableName
- name of the table where the snapshot will be restoredIOException
- if a remote or network exception occursTableExistsException
- if table to be cloned already existspublic byte[] execProcedureWithRet(String signature, String instance, Map<String,String> props) throws IOException
Admin
execProcedureWithRet
in interface Admin
signature
- A distributed procedure is uniquely identified by its signature (default the
root ZK node name of the procedure).instance
- The instance name of the procedure. For some procedures, this parameter is
optional.props
- Property/Value pairs of properties passing to the procedureIOException
public void execProcedure(String signature, String instance, Map<String,String> props) throws IOException
Admin
execProcedure
in interface Admin
signature
- A distributed procedure is uniquely identified by its signature (default the
root ZK node name of the procedure).instance
- The instance name of the procedure. For some procedures, this parameter is
optional.props
- Property/Value pairs of properties passing to the procedureIOException
public boolean isProcedureFinished(String signature, String instance, Map<String,String> props) throws IOException
Admin
isProcedureFinished
in interface Admin
signature
- The signature that uniquely identifies a procedureinstance
- The instance name of the procedureprops
- Property/Value pairs of properties passing to the procedureIOException
- if the specified procedure finished with errorpublic List<SnapshotDescription> listSnapshots() throws IOException
Admin
listSnapshots
in interface Admin
IOException
- if a network error occurspublic List<SnapshotDescription> listSnapshots(String regex) throws IOException
Admin
listSnapshots
in interface Admin
regex
- The regular expression to match againstIOException
- if a remote or network exception occurspublic List<SnapshotDescription> listSnapshots(Pattern pattern) throws IOException
Admin
listSnapshots
in interface Admin
pattern
- The compiled regular expression to match againstIOException
- if a remote or network exception occurspublic List<SnapshotDescription> listTableSnapshots(String tableNameRegex, String snapshotNameRegex) throws IOException
Admin
listTableSnapshots
in interface Admin
tableNameRegex
- The table name regular expression to match againstsnapshotNameRegex
- The snapshot name regular expression to match againstIOException
- if a remote or network exception occurspublic List<SnapshotDescription> listTableSnapshots(Pattern tableNamePattern, Pattern snapshotNamePattern) throws IOException
Admin
listTableSnapshots
in interface Admin
tableNamePattern
- The compiled table name regular expression to match againstsnapshotNamePattern
- The compiled snapshot name regular expression to match againstIOException
- if a remote or network exception occurspublic void deleteSnapshot(byte[] snapshotName) throws IOException
Admin
deleteSnapshot
in interface Admin
snapshotName
- name of the snapshotIOException
- if a remote or network exception occurspublic void deleteSnapshot(String snapshotName) throws IOException
Admin
deleteSnapshot
in interface Admin
snapshotName
- name of the snapshotIOException
- if a remote or network exception occurspublic void deleteSnapshots(String regex) throws IOException
Admin
deleteSnapshots
in interface Admin
regex
- The regular expression to match againstIOException
- if a remote or network exception occurspublic void deleteSnapshots(Pattern pattern) throws IOException
Admin
deleteSnapshots
in interface Admin
pattern
- pattern for names of the snapshot to matchIOException
- if a remote or network exception occurspublic void deleteTableSnapshots(String tableNameRegex, String snapshotNameRegex) throws IOException
Admin
deleteTableSnapshots
in interface Admin
tableNameRegex
- The table name regular expression to match againstsnapshotNameRegex
- The snapshot name regular expression to match againstIOException
- if a remote or network exception occurspublic void deleteTableSnapshots(Pattern tableNamePattern, Pattern snapshotNamePattern) throws IOException
Admin
deleteTableSnapshots
in interface Admin
tableNamePattern
- The compiled table name regular expression to match againstsnapshotNamePattern
- The compiled snapshot name regular expression to match againstIOException
- if a remote or network exception occurspublic void setQuota(QuotaSettings quota) throws IOException
Admin
setQuota
in interface Admin
quota
- the quota settingsIOException
- if a remote or network exception occurspublic QuotaRetriever getQuotaRetriever(QuotaFilter filter) throws IOException
Admin
getQuotaRetriever
in interface Admin
filter
- the quota settings filterIOException
- if a remote or network exception occurspublic CoprocessorRpcChannel coprocessorService()
Admin
RpcChannel
instance connected to the active
master. The obtained RpcChannel
instance can be used to access
a published coprocessor Service
using standard protobuf service
invocations:
CoprocessorRpcChannel channel = myAdmin.coprocessorService(); MyService.BlockingInterface service = MyService.newBlockingStub(channel); MyCallRequest request = MyCallRequest.newBuilder() ... .build(); MyCallResponse response = service.myCall(null, request);
coprocessorService
in interface Admin
public CoprocessorRpcChannel coprocessorService(ServerName serverName)
Admin
RpcChannel
instance
connected to the passed region server.
The obtained RpcChannel
instance can be used to access a published
coprocessor Service
using standard protobuf service invocations:
CoprocessorRpcChannel channel = myAdmin.coprocessorService(serverName); MyService.BlockingInterface service = MyService.newBlockingStub(channel); MyCallRequest request = MyCallRequest.newBuilder() ... .build(); MyCallResponse response = service.myCall(null, request);
coprocessorService
in interface Admin
serverName
- the server name to which the endpoint call is madepublic void updateConfiguration(ServerName server) throws IOException
Admin
updateConfiguration
in interface Admin
server
- : The server whose config needs to be updated.IOException
public void updateConfiguration() throws IOException
Admin
updateConfiguration
in interface Admin
IOException
public int getMasterInfoPort() throws IOException
Admin
getMasterInfoPort
in interface Admin
IOException
public long getLastMajorCompactionTimestamp(TableName tableName) throws IOException
Admin
getLastMajorCompactionTimestamp
in interface Admin
tableName
- table to examineIOException
- if a remote or network exception occurspublic long getLastMajorCompactionTimestampForRegion(byte[] regionName) throws IOException
Admin
getLastMajorCompactionTimestampForRegion
in interface Admin
regionName
- region to examineIOException
- if a remote or network exception occurspublic void compact(TableName tableName, byte[] columnFamily, CompactType compactType) throws IOException, InterruptedException
compact
in interface Admin
tableName
- table to compactcolumnFamily
- column family within a tablecompactType
- CompactType
IOException
- if not a mob column family or if a remote or network exception occursInterruptedException
public void compact(TableName tableName, CompactType compactType) throws IOException, InterruptedException
compact
in interface Admin
tableName
- table to compactcompactType
- CompactType
IOException
InterruptedException
public void majorCompact(TableName tableName, byte[] columnFamily, CompactType compactType) throws IOException, InterruptedException
majorCompact
in interface Admin
tableName
- table to compactcolumnFamily
- column family within a tablecompactType
- CompactType
IOException
- if not a mob column family or if a remote or network exception occursInterruptedException
public void majorCompact(TableName tableName, CompactType compactType) throws IOException, InterruptedException
majorCompact
in interface Admin
tableName
- table to compactcompactType
- CompactType
IOException
InterruptedException
public CompactionState getCompactionState(TableName tableName, CompactType compactType) throws IOException
getCompactionState
in interface Admin
tableName
- table to examinecompactType
- CompactType
IOException
- if a remote or network exception occurspublic List<SecurityCapability> getSecurityCapabilities() throws IOException
Admin
getSecurityCapabilities
in interface Admin
IOException
public boolean[] setSplitOrMergeEnabled(boolean enabled, boolean synchronous, MasterSwitchType... switchTypes) throws IOException
Admin
setSplitOrMergeEnabled
in interface Admin
enabled
- enabled or notsynchronous
- If true, it waits until current split() call, if outstanding, to return.switchTypes
- switchType list MasterSwitchType
IOException
public boolean isSplitOrMergeEnabled(MasterSwitchType switchType) throws IOException
Admin
isSplitOrMergeEnabled
in interface Admin
IOException
public void addReplicationPeer(String peerId, ReplicationPeerConfig peerConfig) throws IOException
Admin
addReplicationPeer
in interface Admin
peerId
- a short name that identifies the peerpeerConfig
- configuration for the replication slave clusterIOException
public void removeReplicationPeer(String peerId) throws IOException
Admin
removeReplicationPeer
in interface Admin
peerId
- a short name that identifies the peerIOException
public void enableReplicationPeer(String peerId) throws IOException
Admin
enableReplicationPeer
in interface Admin
peerId
- a short name that identifies the peerIOException
public void disableReplicationPeer(String peerId) throws IOException
Admin
disableReplicationPeer
in interface Admin
peerId
- a short name that identifies the peerIOException
public ReplicationPeerConfig getReplicationPeerConfig(String peerId) throws IOException
Admin
getReplicationPeerConfig
in interface Admin
peerId
- a short name that identifies the peerIOException
public void updateReplicationPeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws IOException
Admin
updateReplicationPeerConfig
in interface Admin
peerId
- a short name that identifies the peerpeerConfig
- new config for the peerIOException
public void appendReplicationPeerTableCFs(String id, Map<TableName,? extends Collection<String>> tableCfs) throws ReplicationException, IOException
Admin
appendReplicationPeerTableCFs
in interface Admin
id
- a short that identifies the clustertableCfs
- A map from tableName to column family namesReplicationException
IOException
public void removeReplicationPeerTableCFs(String id, Map<TableName,? extends Collection<String>> tableCfs) throws ReplicationException, IOException
Admin
removeReplicationPeerTableCFs
in interface Admin
id
- a short name that identifies the clustertableCfs
- A map from tableName to column family namesReplicationException
IOException
public List<ReplicationPeerDescription> listReplicationPeers() throws IOException
Admin
listReplicationPeers
in interface Admin
IOException
public List<ReplicationPeerDescription> listReplicationPeers(String regex) throws IOException
Admin
listReplicationPeers
in interface Admin
regex
- The regular expression to match peer idIOException
public List<ReplicationPeerDescription> listReplicationPeers(Pattern pattern) throws IOException
Admin
listReplicationPeers
in interface Admin
pattern
- The compiled regular expression to match peer idIOException
public void drainRegionServers(List<ServerName> servers) throws IOException
Admin
drainRegionServers
in interface Admin
servers
- List of region servers to drain.IOException
public List<ServerName> listDrainingRegionServers() throws IOException
Admin
listDrainingRegionServers
in interface Admin
IOException
public void removeDrainFromRegionServers(List<ServerName> servers) throws IOException
Admin
removeDrainFromRegionServers
in interface Admin
servers
- List of region servers to remove drain from.IOException
public List<TableCFs> listReplicatedTableCFs() throws IOException
Admin
listReplicatedTableCFs
in interface Admin
IOException
public void enableTableReplication(TableName tableName) throws IOException
Admin
enableTableReplication
in interface Admin
tableName
- name of the tableIOException
- if a remote or network exception occurspublic void disableTableReplication(TableName tableName) throws IOException
Admin
disableTableReplication
in interface Admin
tableName
- name of the tableIOException
- if a remote or network exception occurspublic void clearCompactionQueues(ServerName sn, Set<String> queues) throws IOException, InterruptedException
Admin
clearCompactionQueues
in interface Admin
sn
- the region server namequeues
- the set of queue nameIOException
- if a remote or network exception occursInterruptedException
Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.