How to start HBase interactive shell and how HBase general commands works

Last updated on May 30 2022
Sonali Singh

Table of Contents

How to start HBase interactive shell and how HBase general commands works

HBase – Shell

This blog explains how to start HBase interactive shell that comes along with HBase.

HBase Shell

HBase contains a shell using which you can communicate with HBase. HBase uses the Hadoop File System to store its data. It will have a master server and region servers. The data storage will be in the form of regions (tables). These regions will be split up and stored in region servers.

The master server manages these region servers and all these tasks take place on HDFS. Given below are some of the commands supported by HBase Shell.

General Commands

  • status – Provides the status of HBase, for instance, the number of servers.
  • version – Provides the version of HBase being employed.
  • table_help – Provides help for table-reference commands.
  • whoami – Provides information about the user.

Data Definition Language

These are the commands that operate on the tables in HBase.

  • create – Creates a table.
  • list – Lists all the tables in HBase.
  • disable – Disables a table.
  • is_disabled – Verifies whether a table is disabled.
  • enable – Enables a table.
  • is_enabled – Verifies whether a table is enabled.
  • describe – Provides the description of a table.
  • alter – Alters a table.
  • exists – Verifies whether a table exists.
  • drop – Drops a table from HBase.
  • drop_all – Drops the tables matching the ‘regex’ given in the command.
  • Java Admin API – Prior to all the above commands, Java provides an Admin API to achieve DDL functionalities through programming. Under org.apache.hadoop.hbase.client package, HBaseAdmin and HTableDescriptor are the two important classes in this package that provide DDL functionalities.

Data Manipulation Language

  • put – Puts a cell value at a specified column in a specified row in a particular table.
  • get – Fetches the contents of row or a cell.
  • delete – Deletes a cell value in a table.
  • deleteall – Deletes all the cells in a given row.
  • scan – Scans and returns the table data.
  • count – Counts and returns the number of rows in a table.
  • truncate – Disables, drops, 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’ve to navigate to the HBase home folder.

cd /usr/localhost/

cd Hbase

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

./bin/hbase shell

If you’ve successfully installed HBase in your system, then it gives you the HBase shell prompt as shown below.

HBase Shell; enter ‘help<RETURN>’ for list of supported commands.

Type “exit<RETURN>” to leave the HBase Shell

Version 0.94.23, rf42302b28aceaab773b15f234aa8718fff7eea3c, Wed Aug 27

00:54:09 UTC 2014

 

hbase(main):001:0>

To exit the interactive shell command at any moment, type exit or use <ctrl+c>. Check the shell functioning before proceeding further. Use the list command for this purpose. List is a command employed to get 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.

hbase(main):001:0> list

When you type this command, it gives you the subsequent output.

hbase(main):001:0> list

TABLE

HBase – General Commands

The general commands in HBase are status, version, table_help, and whoami. This section explains these commands.

status

This command returns the status of the system including the details of the servers running on the system. Its syntax is as follows:

hbase(main):009:0> status

If you execute this command, it returns the subsequent output.

hbase(main):009:0> status

3 servers, 0 dead, 1.3333 average load

version

This command returns the version of HBase employed in your system. Its syntax is as follows:

hbase(main):010:0> version

If you execute this command, it returns the subsequent output.

hbase(main):009:0> version

0.98.8-hadoop2, r6cfc8d064754251365e070a10a82eb169956d5fe, Fri Nov 14

18:26:29 PST 2014

table_help

This command guides you what and how to use table-referenced commands. Given below is the syntax to use this command.

hbase(main):02:0> table_help

When you use this command, it shows help topics for table-related commands. Given below is the partial output of this command.

hbase(main):002:0> table_help

Help for table-reference commands.

You can either create a table via ‘create’ and then manipulate the table

via commands like ‘put’, ‘get’, etc.

See the standard help information for how to use each of these commands.

However, as of 0.96, you can also get a reference to a table, on which

you can invoke commands.

For instance, you can get create a table and keep around a reference to

it via:

hbase> t = create ‘t’, ‘cf’……

whoami

This command returns the user details of HBase. If you execute this command, returns the current HBase user as shown below.

hbase(main):008:0> whoami

hadoop (auth:SIMPLE)

groups: hadoop

 

So, this brings us to the end of blog. This Tecklearn ‘How to start HBase interactive shell and how HBase general commands work’ helps you with commonly asked questions if you are looking out for a job in HBase and No-SQL Database Domain.

If you wish to learn HBase and build a career in HBase or No-SQL Database domain, then check out our interactive, Apache HBase Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/apache-hbase-training/

Apache HBase Training

About the Course

Tecklearn Apache HBase training will master the powerful NoSQL distributed database. You will learn HBase architecture, data analytics using HBase, integration with Hive, monitoring cluster using ZooKeeper and working on real-life industry projects. Build your career as a certified HBase professional through our hands-on training with real-world examples. Upon completion of this online training, you will hold a solid understanding and hands-on experience with Apache HBase.

Why Should you take Apache HBase Training?

  • HBase is now the largest data-driven service serving top websites including Facebook Messaging Platform.
  • There is Strong demand for HBase qualified professionals and they are paid big bucks for the right skills.
  • According to indeed.com, the average pay of an HBase developer stands at $81,422 per annum.

What you will Learn in this Course?

Introduction to HBase and NoSQL

  • Introduction to HBase
  • Fundamentals of HBase
  • What is NoSQL
  • NoSQL Vs RDBMS
  • Why HBase
  • Where to use HBase

HBase Data Modelling

  • Data Modelling
  • HDFS vs. HBase
  • HBase Use Cases

HBase Architecture and Components

  • HBase Architecture
  • Components of HBase Cluster

HBase Installation

  • Prerequisites for HBase Installation
  • Installation Steps

Programming in HBase

  • Create an Eclipse Project for HBase
  • Simple Table Creation from Java in HBase
  • HBase API
  • HBase Shell
  • Primary operations and advanced operations

Integration of Hive with HBase

  • Create a table and insert data into it
  • Integration of Hive with HBase
  • HBase Mapping

Deep Dive into HBase

  • Input Data into HBase
  • File Loading
  • HDFS File
  • HBase handling files in File System
  • WAL
  • Seek Vs Transfer
  • HBase ACID Properties

Got a question for us? Please mention it in the comments section and we will get back to you.

 

0 responses on "How to start HBase interactive shell and how HBase general commands works"

Leave a Message

Your email address will not be published. Required fields are marked *