HBase Shell - HBase

What is HBase shell?

This chapter gives detailed description on how to start HBase interactive shell which comes along with HBase.

HBase Shell

HBase consists of a shell which is used to communicate with HBase. HBase uses Hadoop File System for storing its data. It will have a master server and region servers and data storage would be in the form of regions (tables). These regions will be split and stored in region servers.

Master server manages these region servers on HDFS. Below are some of the commands which HBase Shell supports.

General Commands

  • status – this will provide the status of HBase, such as number of servers.
  • version - this will provide the version of HBase being used.
  • table_help - this will provide help for table-reference commands.
  • whoami - this will provide information about the user.

Data Definition Language

Below are the commands which operate on the tables in HBase.

  • create – this will create a table.
  • list - this will list all the tables in HBase.
  • disable - this will disable a table.
  • is_disabled - this will verify if a table is disabled.
  • enable - this will enable a table.
  • is_enabled – this will verify if a table is enabled.
  • describe – this will provide description of a table.
  • alter - this will alter a table.
  • exists - this will verify if a table exists.
  • drop – this will drop a table from HBase.
  • drop_all - this will drop the tables matching ‘regex’ given in the command.
  • Java Admin API - Previous to all the above commands, Java provides an Admin API for achieving DDL functionalities through programming. Under org.apache.hadoop.hbase.client package, HBaseAdmin and HTableDescriptor are the two important classes in this package which provide DDL functionalities.

Data Manipulation Language

  • put – this will place a cell value at a stated column in a specified row in a particular table.
  • get - this will fetch the contents of row or a cell.
  • delete - this will delete a cell value in a table.
  • deleteall – this will delete all the cells in a given row.
  • scan - this will scan and returns the table data.
  • count - this will count and returns the number of rows in a table.
  • truncate - this will disable, drop, and recreates a specified table.
  • Java client API - Prior to all the above commands, Java provides a client API to achieve DML functionalities, CRUD (Create Retrieve Update Delete) operations and more through programming, under org.apache.hadoop.hbase.client package. HTable Put and Get are the important classes in this package.

Starting HBase Shell

To access the HBase shell, you have to navigate to the HBase home folder.

You can start HBase interactive shell using “hbase shell” command as shown below.

If HBase is successfully installed in your system, then it will give you the HBase shell prompt as shown below.

To exit the interactive shell command at any moment, type exit or use <ctrl+c>. you have to check the shell functioning before proceeding further and use the list command for this. List is a command which is used for getting the list of all the tables in HBase. First of all, verify the installation and the configuration of HBase in your system using this command as shown below.

When you type the above command, it gives below output.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

HBase Topics