Java APIs
HBase adopts the same APIs as those of Apache HBase. For details, visit http://hbase.apache.org/apidocs/index.html.
Newly Added or Modified APIs
- org.apache.hadoop.hbase.Cell of HBase 0.98.3 rather than org.apache.hadoop.hbase.KeyValue of HBase 0.94 is recommended as the key-value data object.
- It is recommended that HConnection connection = HConnectionManager.createConnection(conf) be used to create a connection pool in HBase 0.98.3. The HTablePool is abandoned.
- For details about the new EndPoint API, visit http://hbase.apache.org/book/cp.html.
- The isReversed() and setReversed(boolean reversed) reversed scan methods are added to org.apache.hadoop.hbase.client.Scan.
- For details about API changes from HBase 0.98 to HBase 1.0, visit https://issues.apache.org/jira/browse/hbase-10602.
- org.apache.hadoop.hbase.mapreduce rather than org.apache.hadoop.hbase.mapred is recommended for HBase 1.0.
- For details about the version, visit https://blogs.apache.org/hbase/entry/start_of_a_new_era.
- New APIs added to obtain HBase replication metrics
Table 1 org.apache.hadoop.hbase.client.replication.ReplicationAdmin Method
Description
getSourceMetricsSummary(String id)
Parameter type: String
The source metric summary of the peer ID needs to be obtained.
Return type: Map<String, String>
Returned: A map, where the key is the RegionServer name and the value is the source cluster metric summary of the specified peer ID. Summary metrics are sizeOfLogToReplicate and timeForLogToReplicate.
getSourceMetrics(String id)
Parameter type: String
The source metric summary of the peer ID needs to be obtained.
Return type: Map<String, String>
Returned: A map, where the key is the RegionServer name and the value is the source cluster metric of the specified peer ID.
getSinkMetrics()
Return type: Map<String, String>
Returned: A map, where the key is the RegionServer name and the value is the source cluster sink metric of the specified peer ID.
getPeerSinkMetrics(String id)
Parameter type: String
The source metric summary of the peer ID needs to be obtained.
Return type: Map<String, String>
Returned: A map, where the key is the RegionServer name and the value is the source cluster sink metric of the specified peer ID.
All methods return a Map, where the key is "RegionServer name (IP/Host)" and the value is the string containing all the metrics in format of 'Metric Name'='Metric Value' [, 'Metric Name'= 'Metric Value']*.
Example: SizeOfHFileRefsQueue=0, AgeOfLastShippedOp=0
Table 2 org.apache.hadoop.hbase.replication.ReplicationLoadSource Method
Description
getPeerID()
Return type: String
Returned: peer cluster ID
getAgeOfLastShippedOp()
Return type: long
Returned: milliseconds that the last successful replication request lasts
getSizeOfLogQueue()
Return type: long
Returned: write-ahead logs (WALs) waiting for replication in the queue
getTimeStampOfLastShippedOp()
Return type: long
Returned: timestamp of the last successful replication request
getReplicationLag()
Return type: long
Returned: interval between current time and the time of the last successful replication request
getShippedOps()
Return type: long
Returned: total number of data ops transferred
getShippedBytes()
Return type: long
Returned: total number of data bytes transferred
getShippedBatches()
Return type: long
Returned: total number of data batches transferred
getLogReadInBytes()
Return type: long
Returned: total number of bytes read from WAL
getLogEditsRead()
Return type: long
Returned: total number of edits read from WAL
getSizeOfLogToReplicate()
Return type: long
Returned: total size of WALs waiting to be replicated in the queue
getTimeForLogToReplicate()
Return type: long
Returned: seconds spent in replicating WALs in the queue
getShippedHFiles()
Return type: long
Returned: total number of HFiles transferred
getSizeOfHFileRefsQueue()
Return type: long
Returned: total number of HFiles waiting to be replicated
getLogEditsFiltered()
Return type: long
Returned: total number of WAL edits filtered
getFailedReplicationAttempts()
Return type: long
Returned: times failed to replicate data for a single request
Table 3 org.apache.hadoop.hbase.replication.ReplicationLoadSink Method
Description
getAgeOfLastAppliedOp()
Return type: long
Returned: milliseconds that the last successful applied WAL edits last
getTimeStampsOfLastAppliedOp()
Return type: long
Returned: timestamp of the last successful applied WAL edit
getAppliedBatches()
Return type: long
Returned: total number of data batches applied
getAppliedOps()
Return type: long
Returned: total number of data ops applied
getAppliedHFiles()
Return type: long
Returned: total number of HFiles applied
The new API OF Replication Admin obtains the metric values from HMaster. Each RegionServer reports status to HMaster at every heartbeat interval, which is 3 seconds by default. Therefore, this API reports the latest metric value at the last heartbeat by using the RegionServer.
If you need the latest metric value, use the JMX API provided by the RegionServer.
- 1.3.1 (MRS 1.9.2) API Changes
- Added HIndex API
Table 4 org.apache.hadoop.hbase.hindex.client.HIndexAdmin Method
Description
addIndices(TableName tablename,TableIndices tableIndices)
Parameter: TableName
Name of the table to which the user wants to add a specified index.
Parameter: TableIndices
Table index to be added to the table
Return type: void
addIndicesWithData(TableName tablename,TableIndices tableIndices)
Parameter: TableName
Name of the table to which the user wants to add a specified index
Parameter: TableIndices
Table index to be added to the table
Return type: void
dropIndices(TableName tableName,List <String> list)
Parameter: TableName
Name of the table from which the user wants to delete an index
Parameter: List<String>
Contains the list of indexes to be deleted.
Return type: void
dropIndicesWithData(TableName tableName,List <String> list)
Parameter: TableName
Name of the table from which the user wants to delete a specified index
Parameter: List<String>
Contains the list of indexes to be deleted.
Return type: void
disableIndices(TableName tableName,List <String> list)
Parameter: TableName
Name of the table for which the user wants to disable a specified index
Parameter: List<String>
Contains the list of indexes to be disabled.
Return type: void
enableIndices(TableName tableName,List <String> list)
Parameter: TableName
Name of the table for which the user wants to enable a specified index
Parameter: List<String>
Contains the list of indexes to be enabled.
Return type: void
listIndices(TableName tableName)
Parameter: TableName
Name of the table for which the user wants to list all indexes
Return type: List <Pair <HIndexSpecification,IndexState >>
Return: A secondary index list is returned. The first element is the index specification, and the second element is the current state of the index.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.