Commonly used HBase Table Management Shell Commands

  • Post author:
  • Post last modified:March 12, 2018
  • Post category:BigData
  • Reading time:5 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 jruby interactive shell. You can also use the Java API to interact with Hbase. In this article, we will check some commonly used HBase table management shell commands and explanation on how to use them.

Commonly used HBase Table Management Shell Commands

Commonly used HBase Table Management Shell Commands

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

The commonly used HBase table management shell commands are: List, Create, Describe, Disable, Disable_all, Enable,Enable_all, Drop, Drop_all, Show_filters, Alter, Alter_status.

HBase List Command

The HBase list command will display the list of the table present in the HBase, It will show the all tables including one present in different namespace.

Below is the example of the list command:

hbase(main):051:0> list
TABLE
emp
emp1
my_ns:test
personal
test:test1
5 row(s) in 0.0080 seconds

=> ["SYSTEM.CATALOG", "SYSTEM.FUNCTION", "SYSTEM.SEQUENCE", "SYSTEM.STATS", "emp", "emp1", "my_ns:test", "personal, "test:test1"]

HBase Create Command

Create command is used to create a table in the HBase.

Read:

HBase Describe Command

This command describes the named given table. It will give more information about columns and column families present in the given table. This command also display the various attributes such as VERSIONS, TTL etc.

HBase Describe Example

Below is the example of HBase describe the table which we have created:

hbase(main):053:0> describe 'test'
Table test is ENABLED
test
COLUMN FAMILIES DESCRIPTION
{NAME => 'colF', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSIO
N => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
1 row(s) in 0.1380 seconds

HBase is_enabled Command

This command is used to verify the named tables is enable or disabled.

HBase is_enabled Command Example

Below is example to demonstrate is_enabled command:

hbase(main):061:0> is_enabled 'test'
true
0 row(s) in 0.0200 seconds

HBase disable and disable_all Command

It is mandatory to disable table if you want to delete or drop it. HBase disable table command disable the named table. Use disable_all command to disable all tables that matches the regular expression.

HBase disable and disable_all Syntax

Below is the syntax of HBase disable and disable_all command:

disable <table name>

disable_all <RegExp>

HBase disable and disable_all Command Example

Below is the example to demonstrate disable and disable_all

hbase(main):054:0> disable 'test'
0 row(s) in 2.4540 seconds

hbase(main):057:0> disable_all 'test.*'
test
test:test1
Disable the above 2 tables (y/n)?
y
2 tables successfully disabled

HBase enable and enable_all Command

HBase enable and enable_all command is used to enable the named table(s). Use enable_all command to enable all tables that matches the regular expression.

HBase enable and enable_all Syntax

Below is the syntax of HBase enable and enable_all command:

enable <table name>
enable_all <RegExp>

HBase disable and disable_all Command Example

Below is the example to demonstrate disable and disable_all commands.

hbase(main):055:0> enable 'test'
0 row(s) in 1.2860 seconds

hbase(main):058:0> enable_all 'test.*'
test
test:test1
Enable the above 2 tables (y/n)?
y
2 tables successfully enabled

HBase drop and drop_all Command

This command is used to drop the named table. Drop_all command drops all tables that matched regular expression.

Read: HBase drop table command and Examples

HBase show_filters Command

This command is used to displays all the filters present in HBase such as ColumnPrefix Filter, TimestampsFilter, PageFilter, FamilyFilter, etc.

Below is the example to use show_filters:

hbase(main):059:0> show_filters
DependentColumnFilter
KeyOnlyFilter
ColumnCountGetFilter
SingleColumnValueFilter
PrefixFilter
SingleColumnValueExcludeFilter
FirstKeyOnlyFilter
ColumnRangeFilter
TimestampsFilter
FamilyFilter
QualifierFilter
ColumnPrefixFilter
RowFilter
MultipleColumnPrefixFilter
InclusiveStopFilter
PageFilter
ValueFilter
ColumnPaginationFilter

HBase alter Command and Examples

This command is used to alter the named table.

Read:

HBase Alter_status Command

You can use this command to can get the status of the alter command. Which indicates the number of regions of the table that have received the updated schema pass table name.

BHase alter_status command Example

Below is the example to use alter_status command:

hbase(main):060:0> alter_status 'test'
1/1 regions updated.
Done.