Site icon Tutorial

HBase Commands

Use the help command to get a list of commands categorized by type. The command groups can be categorized as

HBase commands for data management are

hbase(main):001:0> create ‘test’, ‘cf’

0 row(s) in 0.4170 seconds

=> Hbase::Table – test

hbase(main):002:0> list ‘test’

TABLE

test

1 row(s) in 0.0180 seconds

=> [“test”]

hbase(main):003:0> put ‘test’, ‘row1’, ‘cf:a’, ‘value1’

0 row(s) in 0.0850 seconds

hbase(main):004:0> put ‘test’, ‘row2’, ‘cf:b’, ‘value2’

0 row(s) in 0.0110 seconds

hbase(main):005:0> put ‘test’, ‘row3’, ‘cf:c’, ‘value3’

0 row(s) in 0.0100 seconds

Here, we insert three values, one at a time. The first insert is at row1, column cf:a, with a value of value1. Columns in HBase are comprised of a column family prefix, cf in this example, followed by a colon and then a column qualifier suffix, a in this case.

hbase(main):006:0> scan ‘test’

ROW COLUMN+CELL

row1column=cf:a, timestamp=1421762485768, value=value1

row2column=cf:b, timestamp=1421762491785, value=value2

row3column=cf:c, timestamp=1421762496210, value=value3

3 row(s) in 0.0230 seconds

hbase(main):007:0> get ‘test’, ‘row1’

COLUMN   CELL

cf:atimestamp=1421762485768, value=value1

1 row(s) in 0.0350 seconds

hbase(main):008:0> disable ‘test’

0 row(s) in 1.1820 seconds

hbase(main):009:0> enable ‘test’

0 row(s) in 0.1770 seconds

Disable the table again if you tested the enable command above:

hbase(main):010:0> disable ‘test’

0 row(s) in 1.1820 seconds

hbase(main):011:0> drop ‘test’

0 row(s) in 0.1370 seconds

$ ./bin/stop-hbase.sh

stopping hbase………………..

$

After issuing the command, it can take several minutes for the processes to shut down. Use the jps to be sure that the HMaster and HRegionServer processes are shut down.

Exit mobile version