Commonly used General Hbase Shell Commands

  • Post author:
  • Post last modified:June 6, 2019
  • Post category:BigData
  • Reading time:4 mins read

Hbase is installed on the top of the Hadoop and it uses the Hadoop file system only. Just like other Bigdata framework such as Hive, Pig etc, Hbase provides interactive shell. You can also use the Java API to interact with Hbase. In this article, we will check some commonly used general Hbase shell commands.

Commonly used General Hbase Shell Commands

Commonly used General Hbase Shell Commands

In HBase, interactive shell mode is used to interact with HBase for table operations, table management, and data modeling. We will check out the general Hbase shell commands.

There are four commonly used Hbase shell commands: Status, version, whoami and table_help.

How to enter Hbase interactive Shell?

To enter the Hbase interactve shell command prompt, you have to go to Hbase installation /bin directory and run ‘hbase shell’ command.

$ hbase shell
Hbase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the Hbase Shell
Version 1.1.2.2.5.0.0-1245, r53538b8ab6749cbb6fdc0fe123b89aa82495fb3f, Fri Aug 26 01:32:27 UTC 2016

General Hbase Shell Commands

Now let us check the commonly used hbase shell commands.

Status

This command will give you the overall system active status. The output of the command includes servers present in the cluster, active server count, and average load value.

hbase(main):028:0> status1 active master, 0 backup masters, 2 servers, 0 dead, 9.0000 average load

Status command accepts some parameters such as ‘summery’, ‘simple’ and ‘detailed’.

Below is the output of status with above mentioned parameters:

hbase(main):030:0> status 'summery'
1 active master, 0 backup masters, 2 servers, 0 dead, 9.0000 average load

hbase(main):031:0> status 'simple'
active master: example-server.company.com:16000 1504172622567
0 backup masters
2 live servers
 example-server1.company.com:16020 1504172608327
….

hbase(main):001:0> status 'detailed'
version 1.1.2.2.5.0.0-1245
0 regionsInTransition
active master: example-server.company.com:16000 1504172622567
0 backup masters
master coprocessors: [BackupController, RangerAuthorizationCoprocessor]
2 live servers
 example-server.company.com1:16020 1504172608327
….

Related Article

Version

This command display the current vesion of the Hbase installed on interactive shell.

Below is the output of the version command:

hbase(main):029:0> version
1.1.2.2.5.0.0-1245, r53538b8ab6749cbb6fdc0fe112b89aa82495fb3f, Fri Aug 26 01:32:27 UTC 2016

whoami

This command display the current hbase ‘user’ details on the interactive shell. Below is the output of whoami command:

hbase(main):002:0> whoami
admin/example-server.company.com@ company.com (auth:KERBEROS)
 groups: admin, hdfs

table_help

This command is basically a help command that provides various table referenced command syntax and its usage.

You can get help for any of the table commands such as ‘create‘, ‘drop‘, ‘delete‘ etc commands.

Below is the sample output of the table_help command:

hbase(main):004: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'

Or, if you have already created the table, you can get a reference to it:
….

Read: