Summary: HBase Notes

Keywords: Programming HBase shell Apache xml

Reference link: http://abloz.com/hbase/book.html#d613e75

The final version: https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/1.3.5/hbase-1.3.5-bin.tar.gz

I. installation

Extract it, then modify hbase-site.xml to specify the storage path of the data;

Entering HBase Environment

./bin/hbase shell

3. Other relevant orders

Enter help and <RETURN> you can see a list of shell commands. The help here is very detailed. Note that table names, rows and columns need quotation marks.

hbase(main):003:0> create 'test', 'cf'
0 row(s) in 1.2200 seconds
hbase(main):003:0> list 'table'
test
1 row(s) in 0.0550 seconds
hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1'
0 row(s) in 0.0560 seconds
hbase(main):005:0> put 'test', 'row2', 'cf:b', 'value2'
0 row(s) in 0.0370 seconds
hbase(main):006:0> put 'test', 'row3', 'cf:c', 'value3'
0 row(s) in 0.0450 seconds

Query table records:

scan 'test'

//The results are as follows:
hbase(main):007:0> scan 'test'
ROW                                                          COLUMN+CELL                                                                                                                                                                    
 row1                                                        column=cf:a, timestamp=1569377730360, value=value1                                                                                                                             
 row2                                                        column=cf:b, timestamp=1569377741669, value=value2                                                                                                                             
 row3                                                        column=cf:c, timestamp=1569377747279, value=value3 

Query a row according to key:

hbase(main):008:0> get 'test', 'row1'
COLUMN                                                       CELL                                                                                                                                                                           
 cf:a                                                        timestamp=1569377730360, value=value1                                                                                                                                          
1 row(s) in 0.0180 seconds

Disabled drop s the table again, which clears the operation you just did.

hbase(main):012:0> disable 'test'
0 row(s) in 1.0930 seconds
hbase(main):013:0> drop 'test'
0 row(s) in 0.0770 seconds

Close shell

hbase(main):014:0> exit

Stop HBase

Run the stop script to stop HBase.

$ ./bin/stop-hbase.sh
stopping hbase...............

The above steps are only applicable to the experiment and test in a single computer environment.

Posted by pas07920 on Tue, 01 Oct 2019 09:35:56 -0700