EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Data Science Data Science Tutorials Hadoop Tutorial HBase Shell Commands
 

HBase Shell Commands

Priya Pedamkar
Article byPriya Pedamkar

HBase Shell Commands

Introduction to HBase Shell Commands

In this article, we will learn about HBase Shell Commands. HBase Shell is a very powerful tool to communicate with HBase. The shell will support the Data Definition and Data Manipulation Language of HBase in it. With the help of the ruby language, The shell is created.  After the successful installation of the HBase over the Hadoop Eco System. We can able to communicate with HBase environment via HBase Shell and Java API.

 

 

How to Login HBase Shell?

  • Open any remote access client software like putty, MobaXterm, etc.
  • Enter the IP address of the HBase Server with User ID and Password.
  • Once you will log in with the respective user.
  • Enter the “HBase shell” and hit enter. Now you will able to login in the HBase Shell

Code:

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

hbase shell

Output:

HBase Shell Commands - 1

Different Categories in HBase Shell Commands

Below we will learn the three different categories in HBase Shell Commands:

  • Informative Commands
  • Data Definition Language
  • Data Manipulation Language

1. Informative Commands

Below are the commands for Informative:

 a. “whoami “ command

It is giving the information, from which user you have login in and from which group a user belongs to.

Code:

whoami

Output:

HBase Shell Commands - 2

Explanation:

  • User Name: Piyush
  • Group: info
b. “version” command

The command is useful to get information about HBase Version is available.

Code:

version

Output:

HBase Shell Commands - 3

c. “status” command

It is helpful to get detail information of how many HBase Master, HBase Region Server, HBase Server we have. In case, if any region server may dead + average load on the server. It will also update in the same command

Code:

status

Output:

HBase Shell Commands - 4

2. Data Definition Language

Below are the points that define the data language with codes and outputs:

a. Create Table

The create command is useful to create the table. We need to provide the table name and column family name in it.

Syntax:

create <table_name>, <column_family_name>

Code:

create 'eduCBA','sr_no','student_name','roll_name','std','sct','address'

Output:

HBase Shell Commands - 5

b. List Table

The list command is useful to get all the list of tables in HBase.

Code:

list

Output:

HBase Shell Commands - 6

c. Describe Table

The describe command will help to get the detail information of the table. It will give the information of the column family and table is enable or not.

Syntax:

describe <table_name>

Code:

describe 'eduCBA'

Output:

HBase Shell Commands - 7

d. Disable Table

If you want to delete/drop the table form HBase Environment. It is mandatory to disable the table first. Unless and utile if the table will not disable the table will not able to drop or delete from HBase.

Syntax:

disable <table_name>

Code:

disable 'eduCBA'

Output:

HBase Shell Commands - 8

e. Disable_all Table

With the help of disable_all command, we can able to disable all the tables with matching regex value from HBase Environment. If we will run the disable_all command the table will not work or not able to serve any client request in disable_all mode/condition. Once the table will disable, the user can able to delete the table in ‘disable_all’ mode as well.

Syntax:

disable_all <matching_regex_value>

Code:

list

Output:

HBase Shell Commands - 9

Explanation: In the above example, we have a list of tables having ‘education’,’eduCBA’ tables. In ‘disable_all’ command, we have added ‘matching_regex_value=e.*’. After entering the command, it is asking whether we need to disable the table or not. If you will provide ‘y’ (yes). Then the tables start from ‘e’ all the tables will disable.

f. Enable Table

If we have disabled the table. Then the table will not work. If you want to access the table as previously it works. We need to run the ‘enable’ command.

Syntax:

enable <table_name>

Code:

enable 'eduCBA'

Output:

Enable Table

g. Show_filters

It is useful to display all the filters that are present in the HBase environment.

Syntax:

show_filters

Code:

show_filters

Output:

Show_filters

h. Drop-Table

As the name suggested, we can drop the tables from HBase. But before dropping any table from HBase we need to first disable it. Then after we can able to drop the table.

Note: In our case, the ‘education’ table is already in disable mode.

Syntax:

drop <table_name>

Code:

drop 'education'

Output:

Drop-Table

i. Drop_all Table

The drop_all tables are similar to the drop table. In the same command, we need to specify the ‘regex_value’.

Syntax:

drop_all <matching_regex_value>

Code:

drop_all 'edu_.*'

Output:

Drop_all Table

j. Is_enabled

The command is useful to test whether the table enables or not. The values come true then the table is enabled.

Syntax:

is_enabled <table_name>

Code:

is_enabled 'eduCBA'

Output:

Is_enabled

k. Alter Table

As the name suggested we can alter the HBase table. We can add single or multiple column families in the HBase table.

Syntax:

alter <table_name>, NAME=><column_family_name>, VERSIONS=>5

Code:

describe 'eduCBA'

Output:

HBase Shell Commands - 15

HBase Shell Commands - 16

3. Data Manipulation Language

Below are the points explain the data manipulation languages:

a. Count

When we want to know the number of rows present in the HBase table. Then we are using the ‘count’ command. It will display the total number of rows present in it.

Two more major things in it

  • Interval: Default Interval Size in HBase is 10000. If you want to add it. You can add as per the requirement. Ex: let consider if you have 1000000 rows in your table. If you will run the default count then the interval will 10000. If you will mention the interval value of 100000. Then the ‘count’ command will execute in the next 10 intervals only.
  • Cache: Default Size is 10 rows if you will increase it. Then the count command will execute in less time. It details with memory parameters.

Syntax:

count <table_name>, INTERVAL=><VALUE>, CACHE=><VALUE>

Code:

count 'eduCBA_1'

Output:

Count

b. Scan

The ‘scan’ command is useful to check whether the input / inserted value is correctly present in the table or not.

Syntax:

scan <table_name>

Code:

scan 'eduCBA_1'

Output:

Scan

c. Put

It will help to add/put/ insert the data at a specific table. It will also optionally coordinate with a timestamp as well.

Syntax:

put <table_name>, <row>, <col>, <data>

Code:

put 'eduCBA_1' , 'r1', 'c1', 'abc1'

Output:

Put

d. Get

With the help of ‘get’ command, we can able to get or see the contents of the specific table. As per the requirement, we can also able to add time_stamp, time_range, version, filters.

Syntax:

get <table_name>, <row>, <col>

Code:

get 'eduCBA_1' , 'r1', 'c1'

Output:

Get

e. Delete

We can delete the actual data from the HBase table. In delete command, we need to specify the specific row as well as column.

Syntax:

delete <table_name> <row> <col>
Code:

delete 'eduCBA_1' , 'r1', 'c1'

Output:

Delete

f. Delete all

We can delete all the cells from the HBase Table. We can optionally present the column name in it.

Syntax:

deleteall <table_name> <row> <col>

Code

deleteall 'eduCBA_1' , 'r2', 'c1'

Output:

Delete all

g. Truncate

The truncate command will keep the schema of the table. But the records are not present.

Syntax:

truncate <table_name>

Code:

truncate 'eduCBA_1'

Output:

Truncate

Recommended Articles

This is a guide to HBase Shell Commands. Here we discuss an introduction and top three categories in detail with their codes and outputs. You can also go through our other related articles to learn more –

  1. What is HBase?
  2. HBase Architecture
  3. HBase Commands
  4. Apache HBase

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - 🎁 ENROLL NOW