EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

HBase Shell Commands

By Priya PedamkarPriya Pedamkar

Secondary Sidebar
Hadoop Tutorial
  • Advanced
    • What is Yarn in Hadoop
    • Hadoop?Administrator
    • Hadoop DistCp
    • Hadoop Administrator Jobs
    • Hadoop Schedulers
    • Hadoop Distributed File System (HDFS)
    • Hadoop Streaming
    • Apache Hadoop Ecosystem
    • Distributed Cache in Hadoop
    • Hadoop Ecosystem Components
    • Hadoop YARN Architecture
    • HDFS Architecture
    • What is HDFS
    • HDFS Federation
    • Apache HBase
    • HBase Architecture
    • What is Hbase
    • HBase Shell Commands
    • What is MapReduce in Hadoop
    • Mapreduce Combiner
    • MapReduce Architecture
    • MapReduce Word Count
    • Impala Shell
    • HBase Create Table
  • Basics
    • What is Hadoop
    • Career in Hadoop
    • Advantages of Hadoop
    • Uses of Hadoop
    • Hadoop Versions
    • HADOOP Framework
    • Hadoop Architecture
    • Hadoop Configuration
    • Hadoop Components
    • Hadoop WordCount
    • Hadoop Database
    • Hadoop Ecosystem
    • Hadoop Tools
    • Install Hadoop
    • Is Hadoop Open Source
    • What is Hadoop Cluster
    • Hadoop Namenode
    • Hadoop data lake
    • Hadoop fsck
    • HDFS File System
    • Hadoop Distributed File System
  • Commands
    • Hadoop Commands
    • Hadoop fs Commands
    • Hadoop FS Command List
    • HDFS Commands
    • HDFS ls
    • Hadoop Stack
    • HBase Commands
  • Interview Questions
    • Hadoop Admin Interview Questions
    • Hadoop Cluster Interview Questions
    • Hadoop developer interview Questions
    • HBase Interview Questions

Related Courses

Data Science Certification

Online Machine Learning Training

Hadoop Certification

MapReduce Certification Course

Home Data Science Data Science Tutorials Hadoop Tutorial HBase Shell Commands

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.

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (85,938 ratings)

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:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

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
Popular Course in this category
Hadoop Training Program (20 Courses, 14+ Projects, 4 Quizzes)
  20 Online Courses |  14 Hands-on Projects |  135+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Data Scientist Training (85 Courses, 67+ Projects)4.9
Machine Learning Training (20 Courses, 29+ Projects)4.8
MapReduce Training (2 Courses, 4+ Projects)4.7
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

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

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

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

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

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

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

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

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Special Offer - Hadoop Training Program (20 Courses, 14+ Projects, 4 Quizzes) Learn More