Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this quickstart, you learn how to use Apache HBase Shell to create an HBase table, insert data, and then query the table.
If you don't have an Azure subscription, create a free account before you begin.
Prerequisites
An Apache HBase cluster. See Create cluster to create an HDInsight cluster. Ensure you choose the HBase cluster type.
An SSH client. For more information, see Connect to HDInsight (Apache Hadoop) using SSH.
Create a table and manipulate data
For most people, data appears in the tabular format:
In HBase (an implementation of Cloud BigTable), the same data looks like:
You can use SSH to connect to HBase clusters, and then use Apache HBase Shell to create HBase tables, insert data, and query data.
Use
sshcommand to connect to your HBase cluster. Edit the command below by replacingCLUSTERNAMEwith the name of your cluster, and then enter the command:ssh sshuser@CLUSTERNAME-ssh.azurehdinsight.netUse
hbase shellcommand to start the HBase interactive shell. Enter the following command in your SSH connection:hbase shellUse
createcommand to create an HBase table with two-column families. Enter the following command:create 'Contacts', 'Personal', 'Office'Use
listcommand to list all tables in HBase. Enter the following command:listUse
putcommand to insert values at a specified column in a specified row in a particular table. Enter the following command:put 'Contacts', '1000', 'Personal:Name', 'John Dole' put 'Contacts', '1000', 'Personal:Phone', '1-425-000-0001' put 'Contacts', '1000', 'Office:Phone', '1-425-000-0002' put 'Contacts', '1000', 'Office:Address', '1111 San Gabriel Dr.'Use
scancommand to scan and return theContactstable data. Enter the following command:scan 'Contacts'Use
getcommand to fetch contents of a row. Enter the following command:get 'Contacts', '1000'You see similar results as using the
scancommand because there is only one row.Use
deletecommand to delete a cell value in a table. Enter the following command:delete 'Contacts', '1000', 'Office:Address'Use
disablecommand to disable the table. Enter the following command:disable 'Contacts'Use
dropcommand to drop a table from HBase. Enter the following command:drop 'Contacts'Use
exitcommand to stop the HBase interactive shell. Enter the following command:exit
For more information about the HBase table schema, see Introduction to Apache HBase Schema Design. For more HBase commands, see Apache HBase reference guide.
Clean up resources
After you complete the quickstart, you may want to delete the cluster. With HDInsight, your data is stored in Azure Storage, so you can safely delete a cluster when it is not in use. You are also charged for an HDInsight cluster, even when it is not in use. Since the charges for the cluster are many times more than the charges for storage, it makes economic sense to delete clusters when they are not in use.
To delete a cluster, see Delete an HDInsight cluster using your browser, PowerShell, or the Azure CLI.
Next steps
In this quickstart, you learned how to use Apache HBase Shell to create an HBase table, insert data, and then query the table. To learn more about data stored in HBase, the next article will show you how to execute queries with Apache Spark.